mirror of https://github.com/sheumann/hush.git
Fix "wait" builtin to work correctly in no-parameters case
This was another issue where wait() was being called with SIGCHLD masked, and therefore never returning.
This commit is contained in:
parent
d305e3b821
commit
988683c572
11
shell/hush.c
11
shell/hush.c
|
@ -9805,6 +9805,11 @@ static int FAST_FUNC builtin_wait(char **argv)
|
||||||
* signals which we use. Thus, this ugly dance:
|
* signals which we use. Thus, this ugly dance:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
checkjobs(NULL); /* waitpid(WNOHANG) inside */
|
||||||
|
if (errno == ECHILD) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure possible SIGCHLD is stored in kernel's
|
/* Make sure possible SIGCHLD is stored in kernel's
|
||||||
* pending signal mask before we call waitpid.
|
* pending signal mask before we call waitpid.
|
||||||
* Or else we may race with SIGCHLD, lose it,
|
* Or else we may race with SIGCHLD, lose it,
|
||||||
|
@ -9830,12 +9835,6 @@ static int FAST_FUNC builtin_wait(char **argv)
|
||||||
} while (sig < NSIG);
|
} while (sig < NSIG);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
checkjobs(NULL); /* waitpid(WNOHANG) inside */
|
|
||||||
if (errno == ECHILD) {
|
|
||||||
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait for SIGCHLD or any other signal */
|
/* Wait for SIGCHLD or any other signal */
|
||||||
//sig = sigwaitinfo(&allsigs, NULL);
|
//sig = sigwaitinfo(&allsigs, NULL);
|
||||||
/* It is vitally important for sigsuspend that SIGCHLD has non-DFL handler! */
|
/* It is vitally important for sigsuspend that SIGCHLD has non-DFL handler! */
|
||||||
|
|
Loading…
Reference in New Issue