summaryrefslogtreecommitdiff
path: root/tabbed.c
diff options
context:
space:
mode:
Diffstat (limited to 'tabbed.c')
-rw-r--r--tabbed.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/tabbed.c b/tabbed.c
index eafe28a..477a041 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -125,7 +125,6 @@ static void run(void);
static void sendxembed(int c, long msg, long detail, long d1, long d2);
static void setcmd(int argc, char *argv[], int);
static void setup(void);
-static void sigchld(int unused);
static void spawn(const Arg *arg);
static int textnw(const char *text, unsigned int len);
static void toggle(const Arg *arg);
@@ -976,9 +975,16 @@ setup(void)
XWMHints *wmh;
XClassHint class_hint;
XSizeHints *size_hint;
+ struct sigaction sa;
- /* clean up any zombies immediately */
- sigchld(0);
+ /* do not transform children into zombies when they terminate */
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT | SA_RESTART;
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGCHLD, &sa, NULL);
+
+ /* clean up any zombies that might have been inherited */
+ while (waitpid(-1, NULL, WNOHANG) > 0);
/* init screen */
screen = DefaultScreen(dpy);
@@ -1079,15 +1085,6 @@ setup(void)
}
void
-sigchld(int unused)
-{
- if (signal(SIGCHLD, sigchld) == SIG_ERR)
- die("%s: cannot install SIGCHLD handler", argv0);
-
- while (0 < waitpid(-1, NULL, WNOHANG));
-}
-
-void
spawn(const Arg *arg)
{
if (fork() == 0) {