summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/pclose.c
blob: 31afe5be2a8b087c112e9a2c85cf1669f3c04739 (plain)
1
2
3
4
5
6
7
8
9
10
#include <__stdio.h>
#include <stdio.h>    // for fclose, FILE, pclose
#include <sys/wait.h> // for waitpid

int pclose(struct __FILE *stream)
{
	int stat;
	fclose(stream);
	return (waitpid(stream->pid, &stat, 0) < 0) ? -1 : stat;
}