Преглед изворни кода

fix invalid memory access in pclose

Rich Felker пре 13 година
родитељ
комит
9799560f79
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      src/stdio/pclose.c

+ 2 - 1
src/stdio/pclose.c

@@ -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;
 }