Commit b7269dfc authored by Paul Menage's avatar Paul Menage Committed by Linus Torvalds

CGroup API files: strip all trailing whitespace in cgroup_write_u64

This removes the need for people to remember to pass the -n flag to echo when
writing values to cgroup control files.
Signed-off-by: default avatarPaul Menage <menage@google.com>
Cc: "Li Zefan" <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "YAMAMOTO Takashi" <yamamoto@valinux.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2c3daa72
...@@ -1329,10 +1329,7 @@ static ssize_t cgroup_write_u64(struct cgroup *cgrp, struct cftype *cft, ...@@ -1329,10 +1329,7 @@ static ssize_t cgroup_write_u64(struct cgroup *cgrp, struct cftype *cft,
return -EFAULT; return -EFAULT;
buffer[nbytes] = 0; /* nul-terminate */ buffer[nbytes] = 0; /* nul-terminate */
strstrip(buffer);
/* strip newline if necessary */
if (nbytes && (buffer[nbytes-1] == '\n'))
buffer[nbytes-1] = 0;
val = simple_strtoull(buffer, &end, 0); val = simple_strtoull(buffer, &end, 0);
if (*end) if (*end)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment