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:
@ -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;
|
||||||
|
Reference in New Issue
Block a user