xref: /third_party/musl/src/stdio/pclose.c (revision 570af302)
1#include "stdio_impl.h"
2#include <errno.h>
3#include <unistd.h>
4#ifndef __LITEOS__
5#include "param_check.h"
6#endif
7
8int pclose(FILE *f)
9{
10#ifndef __LITEOS__
11	PARAM_CHECK(f);
12#endif
13	int status, r;
14	pid_t pid = f->pipe_pid;
15	fclose(f);
16	while ((r=__sys_wait4(pid, &status, 0, 0)) == -EINTR);
17	if (r<0) return __syscall_ret(r);
18	return status;
19}
20