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

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