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

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