Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top.
This commit is contained in:
parent
21302c2b78
commit
22f383e695
@ -28,7 +28,8 @@ static int read_to_buf(const char *filename, void *buf)
|
|||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
ret = read(fd, buf, PROCPS_BUFSIZE);
|
ret = read(fd, buf, PROCPS_BUFSIZE-1);
|
||||||
|
((char *)buf)[ret > 0 ? ret : 0] = 0;
|
||||||
close(fd);
|
close(fd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user