blob: 83212e961f1dda0c8627e22afb777e53023b7c70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}
}
|