updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / selinux-procps / procps-3.2.7-longcmd.patch
blob7c4fdca360d306d797cf03b35ce2e63af31b5a2a
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
3 @@ -432,14 +432,17 @@
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))
10 end_of_file = 1;
11 - if (n == 0 && rbuf == 0)
12 + if (n == 0 && rbuf == 0) {
13 + close(fd);
14 return NULL; /* process died between our open and read */
15 + }
16 if (n < 0) {
17 if (rbuf)
18 free(rbuf);
19 + close(fd);
20 return NULL; /* read error */
22 if (end_of_file && buf[n-1]) /* last read char not null */