aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorJochen Sprickerhof <dwm@jochen.sprickerhof.de>2015-04-22 17:22:34 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2015-05-04 10:57:40 +0200
commit07ce96a3a0f4a650933f5f586082cbf2064ea2c1 (patch)
tree8d1bf87de67d6cd4f80a9461cefabc0bc55a2882 /st.c
parent190b94c7a2a7bb2f5d55cbb6eb1779fd042c6467 (diff)
downloadst-07ce96a3a0f4a650933f5f586082cbf2064ea2c1.tar.gz
st-07ce96a3a0f4a650933f5f586082cbf2064ea2c1.zip
Fix sigchld
Only wait for termination of the shell.
Diffstat (limited to 'st.c')
-rw-r--r--st.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/st.c b/st.c
index d954288..300cab6 100644
--- a/st.c
+++ b/st.c
@@ -1238,10 +1238,14 @@ execsh(void) {
1238void 1238void
1239sigchld(int a) { 1239sigchld(int a) {
1240 int stat, ret; 1240 int stat, ret;
1241 pid_t p;
1241 1242
1242 if(waitpid(pid, &stat, 0) < 0) 1243 if((p = waitpid(pid, &stat, WNOHANG)) < 0)
1243 die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); 1244 die("Waiting for pid %hd failed: %s\n", pid, strerror(errno));
1244 1245
1246 if(pid != p)
1247 return;
1248
1245 ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE; 1249 ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE;
1246 if (ret != EXIT_SUCCESS) 1250 if (ret != EXIT_SUCCESS)
1247 die("child finished with error '%d'\n", stat); 1251 die("child finished with error '%d'\n", stat);