소스 검색

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