fix invalid memory access in pclose

This commit is contained in:
Rich Felker 2012-06-20 14:47:34 -04:00
parent 9c21f4342c
commit 9799560f79

View File

@ -3,8 +3,9 @@
int pclose(FILE *f)
{
int status;
pid_t pid = f->pipe_pid;
fclose(f);
while (waitpid(f->pipe_pid, &status, 0) == -1)
while (waitpid(pid, &status, 0) == -1)
if (errno != EINTR) return -1;
return status;
}