diff options
| author | Toby Goodwin <toby@paccrat.org> | 2014-09-02 08:01:39 +0100 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:22:10 +0100 |
| commit | a8699a58d8632f21e897ea5c4900a15483a9a8ca (patch) | |
| tree | fd8e7910807eb91bcd79d498582959f1d750f9c6 /testcld.c | |
| parent | d884971193ef4934424b77ae862e8b0ecf70bab3 (diff) | |
release: rc-1.7.2
Diffstat (limited to 'testcld.c')
| -rw-r--r-- | testcld.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 <errno.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> +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; + } +} |