library: once again properly ignore a final empty cgroup

Commit a5881b5a4e, addressing
command lines with a trailing space, produced an undesirable
side effect in the fill_cgroup_cvt() function.

This patch restores correct cgroup behavior while still
producing command lines with no trailing space.
This commit is contained in:
Jim Warner 2011-12-11 12:00:50 -06:00 committed by Craig Small
parent 229be7b160
commit c3a1239efe

View File

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