correct locking in stdio functions that tried to be lock-free
[musl] / src / stdio / pclose.c
1 #include "stdio_impl.h"
2 #include "syscall.h"
3
4 int pclose(FILE *f)
5 {
6         int status, r;
7         pid_t pid = f->pipe_pid;
8         fclose(f);
9         while ((r=__syscall(SYS_wait4, pid, &status, 0, 0)) == -EINTR);
10         if (r<0) return __syscall_ret(r);
11         return status;
12 }