library: once again properly ignore a final empty cgroup
Commit a5881b5a4e5056d13906ce6128f6aa180d67d60e, 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:
parent
229be7b160
commit
c3a1239efe
@ -611,9 +611,10 @@ static int read_unvectored(char *restrict const dst, unsigned sz, const char* wh
|
|||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
if(n){
|
if(n){
|
||||||
int i=n-1;
|
int i=n;
|
||||||
while(i--)
|
while(i--)
|
||||||
if(dst[i]=='\n' || dst[i]=='\0') dst[i]=sep;
|
if(dst[i]=='\n' || dst[i]=='\0') dst[i]=sep;
|
||||||
|
if(dst[n-1]==' ') dst[n-1]='\0';
|
||||||
}
|
}
|
||||||
dst[n] = '\0';
|
dst[n] = '\0';
|
||||||
return n;
|
return n;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user