aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pipe.c
blob: 6a5306f3658fccb772b252468bdc958f2c7caf26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int
main(void)
{
	(void) close(0);
	(void) close(1);
	int fds[2];
	if (pipe(fds) || fds[0] != 0 || fds[1] != 1)
		return 77;

#ifdef HAVE_PIPE2
	(void) close(0);
	(void) close(1);
	if (pipe2(fds, O_NONBLOCK) || fds[0] != 0 || fds[1] != 1)
		return 77;
	return 0;
#else
	return 77;
#endif
}