From c8a77b86b4f8c91314222a8e12e6e37cf182ee10 Mon Sep 17 00:00:00 2001 From: Toby Goodwin Date: Mon, 1 Oct 2012 20:46:40 +0100 Subject: initial commit --- testcld.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 testcld.c (limited to 'testcld.c') diff --git a/testcld.c b/testcld.c new file mode 100644 index 0000000..83212e9 --- /dev/null +++ b/testcld.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include +int main(void) { + int i; + sigset(SIGCLD, SIG_IGN); + switch (fork()) { + case -1: + return 1; + case 0: + return 0; + default: + sleep(1); + if (wait(&i) == -1 && errno == ECHILD) return 0; + else return 1; + } +} -- cgit v1.2.3