aboutsummaryrefslogtreecommitdiffstats
path: root/reapd.c
blob: c3ba45240b009364a1ec3fd3fa76e24a89f77fd0 (plain) (blame)
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
/* See LICENSE file for copyright and license details. */
#include <sys/wait.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>


int
main(int argc, char *argv[])
{
	for (;;) {
		if (wait(NULL) == -1) {
			if (errno == ECHILD)
				return 0;
			if (errno == EINTR)
				continue;
			fprintf(stderr, "%s: wait: %s\n", *argv, strerror(errno));
			return 2;
		}
#ifdef TEST
		printf("reaped\n");
#endif
	}

	(void) argc;
}