Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=622d42cac9ed42098aa50c53994f625abfa3d473
Commit:     622d42cac9ed42098aa50c53994f625abfa3d473
Parent:     e18f6318e5dab189efd4cb0bbfcbd923cc373e3c
Author:     Paul Jackson <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 7 00:13:44 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Feb 7 08:42:18 2008 -0800

    cgroup simplify space stripping
    
    Simplify the space stripping code in cgroup file write.
    
    [EMAIL PROTECTED]: s/BUG_ON/BUILD_BUG_ON/]
    Signed-off-by: Paul Jackson <[EMAIL PROTECTED]>
    Acked-by: Paul Menage <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/cgroup.c |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 54760d5..7d20741 100644
--- a/kernel/cgroup.c
+++ b/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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to