--- st.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index ab291ac..0824894 100644 --- a/st.c +++ b/st.c _AT_@ -712,7 +712,7 @@ sigchld(int a) int stat; pid_t p; - if ((p = waitpid(pid, &stat, WNOHANG)) < 0) + if ((p = waitpid(-1, &stat, WNOHANG)) < 0) die("waiting for pid %hd failed: %s\n", pid, strerror(errno)); if (pid != p) _AT_@ -753,6 +753,7 @@ int ttynew(char *line, char *cmd, char *out, char **args) { int m, s; + struct sigaction sa; if (out) { term.mode |= MODE_PRINT; _AT_@ -804,7 +805,10 @@ ttynew(char *line, char *cmd, char *out, char **args) #endif close(s); cmdfd = m; - signal(SIGCHLD, sigchld); + memset(&sa, 0, sizeof(sa)); + sigemptyset(&sa.sa_mask); + sa.sa_handler = sigchld; + sigaction(SIGCHLD, &sa, NULL); break; } return cmdfd; -- 2.20.1Received on Sat Apr 18 2020 - 20:57:37 CEST
This archive was generated by hypermail 2.3.0 : Sat Apr 18 2020 - 21:00:36 CEST