From a5881b5a4e5056d13906ce6128f6aa180d67d60e Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 8 Dec 2011 10:19:38 -0600 Subject: [PATCH] library: create cmdlines consistently with no trailing space 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/readproc.c b/proc/readproc.c index 9dff16da..dba2597e 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -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; }