parent
190b94c7a2
commit
07ce96a3a0
6
st.c
6
st.c
|
@ -1238,10 +1238,14 @@ execsh(void) {
|
|||
void
|
||||
sigchld(int a) {
|
||||
int stat, ret;
|
||||
pid_t p;
|
||||
|
||||
if(waitpid(pid, &stat, 0) < 0)
|
||||
if((p = waitpid(pid, &stat, WNOHANG)) < 0)
|
||||
die("Waiting for pid %hd failed: %s\n", pid, strerror(errno));
|
||||
|
||||
if(pid != p)
|
||||
return;
|
||||
|
||||
ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE;
|
||||
if (ret != EXIT_SUCCESS)
|
||||
die("child finished with error '%d'\n", stat);
|
||||
|
|
Reference in New Issue