[hackers] [st] Fix sigchld || Jochen Sprickerhof

From: <git_AT_suckless.org>
Date: Mon, 4 May 2015 10:59:29 +0200 (CEST)

commit 07ce96a3a0f4a650933f5f586082cbf2064ea2c1
Author: Jochen Sprickerhof <dwm_AT_jochen.sprickerhof.de>
Date: Wed Apr 22 17:22:34 2015 +0200

    Fix sigchld
    
    Only wait for termination of the shell.

diff --git a/st.c b/st.c
index d954288..300cab6 100644
--- a/st.c
+++ b/st.c
_AT_@ -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);
Received on Mon May 04 2015 - 10:59:29 CEST

This archive was generated by hypermail 2.3.0 : Mon May 04 2015 - 11:00:24 CEST