summaryrefslogtreecommitdiff
path: root/test/unistd/errno.c
blob: 746c21d89e2b3694bc2ea900298e5d833904f8e3 (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
/* based originally on one the clone tests in the LTP */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sched.h>

int child_fn(void *arg)
{
	fprintf(stderr, "in child_fn\n");
	exit(1);
}

int main(void)
{
	int r_clone, ret_errno;

	r_clone = clone(child_fn, NULL, (int) NULL, NULL);
	ret_errno = errno;
	if (ret_errno != EINVAL) {
		fprintf(stderr, "clone: res=%d (%d) errno=%d %m\n",
			r_clone, (int) NULL, errno);
		return 1;
	}

	return 0;
}