From 99573b72a0ba3dfd90ec621b52ad7231c69da38e Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Thu, 7 Feb 2008 00:13:44 -0800 Subject: [PATCH] --- yaml --- r: 83753 b: refs/heads/master c: 622d42cac9ed42098aa50c53994f625abfa3d473 h: refs/heads/master i: 83751: efb942e7fbc37ca2b280db5a4fcdbc5b25d88e6e v: v3 --- [refs] | 2 +- trunk/kernel/cgroup.c | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index debd5d7659d8..3229e7611f05 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e18f6318e5dab189efd4cb0bbfcbd923cc373e3c +refs/heads/master: 622d42cac9ed42098aa50c53994f625abfa3d473 diff --git a/trunk/kernel/cgroup.c b/trunk/kernel/cgroup.c index 54760d5b651e..7d207414f2c7 100644 --- a/trunk/kernel/cgroup.c +++ b/trunk/kernel/cgroup.c @@ -1326,6 +1326,7 @@ static ssize_t cgroup_common_file_write(struct cgroup *cgrp, goto out1; } buffer[nbytes] = 0; /* nul-terminate */ + strstrip(buffer); /* strip -just- trailing whitespace */ mutex_lock(&cgroup_mutex); @@ -1346,21 +1347,9 @@ static ssize_t cgroup_common_file_write(struct cgroup *cgrp, clear_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); break; case FILE_RELEASE_AGENT: - { - struct cgroupfs_root *root = cgrp->root; - /* Strip trailing newline */ - if (nbytes && (buffer[nbytes-1] == '\n')) - buffer[nbytes-1] = 0; - - /* We never write anything other than '\0' - * into the last char of release_agent_path, - * so it always remains a NUL-terminated - * string */ - strncpy(root->release_agent_path, buffer, nbytes); - root->release_agent_path[nbytes] = 0; - + BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); + strcpy(cgrp->root->release_agent_path, buffer); break; - } default: retval = -EINVAL; goto out2;