all repos — st @ 07ce96a3a0f4a650933f5f586082cbf2064ea2c1

st (suckless terminal) config

Fix sigchld

Only wait for termination of the shell.
Jochen Sprickerhof dwm@jochen.sprickerhof.de
commit

07ce96a3a0f4a650933f5f586082cbf2064ea2c1

parent

190b94c7a2a7bb2f5d55cbb6eb1779fd042c6467

1 files changed, 5 insertions(+), 1 deletions(-)

jump to
M st.cst.c

@@ -1238,9 +1238,13 @@

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)