Skip to content

Commit

Permalink
Read errors from /proc/$PID/stat are also possible
Browse files Browse the repository at this point in the history
  • Loading branch information
gollux committed Mar 27, 2018
1 parent fe211cb commit 60caa49
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion isolate.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ read_proc_file(char *buf, char *name, int *fdp)
}
lseek(*fdp, 0, SEEK_SET);
if ((c = read(*fdp, buf, PROC_BUF_SIZE-1)) < 0)
die("read on /proc/$pid/%s: %m", name);
{
// Even this could fail if the process disappeared since open()
return 0;
}
if (c >= PROC_BUF_SIZE-1)
die("/proc/$pid/%s too long", name);
buf[c] = 0;
Expand Down

0 comments on commit 60caa49

Please sign in to comment.