]> granicus.if.org Git - procps-ng/commitdiff
library: create cmdlines consistently with no trailing space
authorJim Warner <james.warner@comcast.net>
Thu, 8 Dec 2011 16:19:38 +0000 (10:19 -0600)
committerCraig Small <csmall@enc.com.au>
Sun, 11 Dec 2011 11:27:12 +0000 (22:27 +1100)
When PROC_FILLARG was used (invoking file2strvec)
command lines contained no trailing space.

When PROC_EDITCMDLCVT was used (invoking read_unvectored)
command lines contained a trailing space.

Now both routes to a cmdline act the same -- no trailing space.

proc/readproc.c

index 9dff16da701cf0f257dd038b1213ab01e3236946..dba2597ecaf55f4d56295f928d84fd720117612e 100644 (file)
@@ -611,7 +611,7 @@ static int read_unvectored(char *restrict const dst, unsigned sz, const char* wh
     }
     close(fd);
     if(n){
-        int i=n;
+        int i=n-1;
         while(i--)
             if(dst[i]=='\n' || dst[i]=='\0') dst[i]=sep;
     }