1 --- procps-3.2.7/proc/readproc.c.kzak 2006-06-16 10:18:13.000000000 +0200
2 +++ procps-3.2.7/proc/readproc.c 2006-09-27 11:25:13.000000000 +0200
4 if(fd==-1) return NULL;
6 /* read whole file into a memory buffer, allocating as we go */
7 - while ((n = read(fd, buf, sizeof buf - 1)) > 0) {
8 + while ((n = read(fd, buf, sizeof buf - 1)) >= 0) {
9 if (n < (int)(sizeof buf - 1))
11 - if (n == 0 && rbuf == 0)
12 + if (n == 0 && rbuf == 0) {
14 return NULL; /* process died between our open and read */
20 return NULL; /* read error */
22 if (end_of_file && buf[n-1]) /* last read char not null */