From: Paul Menage Date: Tue, 29 Apr 2008 07:59:59 +0000 (-0700) Subject: CGroup API files: strip all trailing whitespace in cgroup_write_u64 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b7269dfc826fbf554c9e6a9eaa4e6ff95fa08656;p=openwrt%2Fstaging%2Fblogic.git 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: Paul Menage Cc: "Li Zefan" Cc: Balbir Singh Cc: Paul Jackson Cc: Pavel Emelyanov Cc: KAMEZAWA Hiroyuki Cc: "YAMAMOTO Takashi" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 0bd79a81666a..57afdde871ac 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1329,10 +1329,7 @@ static ssize_t cgroup_write_u64(struct cgroup *cgrp, struct cftype *cft, return -EFAULT; buffer[nbytes] = 0; /* nul-terminate */ - - /* strip newline if necessary */ - if (nbytes && (buffer[nbytes-1] == '\n')) - buffer[nbytes-1] = 0; + strstrip(buffer); val = simple_strtoull(buffer, &end, 0); if (*end) return -EINVAL;