]> granicus.if.org Git - musl/commitdiff
fix invalid memory access in pclose
authorRich Felker <dalias@aerifal.cx>
Wed, 20 Jun 2012 18:47:34 +0000 (14:47 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 20 Jun 2012 18:47:34 +0000 (14:47 -0400)
src/stdio/pclose.c

index c2fe7a24a85107e95e58c8aa947524156dcca6b6..7c7779663e2dd6c191311e5e2cbf65340b00a7a9 100644 (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;
 }