about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2009-08-13 10:45:59 +0100
committerAnselm R Garbe <garbeam@gmail.com>2009-08-13 10:45:59 +0100
commit33fe200b521b19a089d39aca247bb78432e02e6d (patch)
tree81db8d2dfd7a4ad155ab8e99d0c38b17b16c2dc0
parent91fffb3f7d0cd731aa2a2126c411590d30231c19 (diff)
downloaddwm-33fe200b521b19a089d39aca247bb78432e02e6d.tar.gz
added merged patch of anydot and Neale
-rw-r--r--dwm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/dwm.c b/dwm.c
index 873b794..1b30cae 100644
--- a/dwm.c
+++ b/dwm.c
@@ -207,7 +207,7 @@ static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
 static void showhide(Client *c);
-static void sigchld(int signal);
+static void sigchld(int unused);
 static void spawn(const Arg *arg);
 static void tag(const Arg *arg);
 static void tagmon(const Arg *arg);
@@ -1428,6 +1428,10 @@ setup(void) {
 	int w;
 	XSetWindowAttributes wa;
 
+	/* clean up any zombies immediately */
+	signal(SIGCHLD, sigchld);
+	sigchld(0);
+
 	/* init screen */
 	screen = DefaultScreen(dpy);
 	root = RootWindow(dpy, screen);
@@ -1496,13 +1500,13 @@ showhide(Client *c) {
 
 
 void
-sigchld(int signal) {
+sigchld(int unused) {
 	while(0 < waitpid(-1, NULL, WNOHANG));
+	signal(SIGCHLD, sigchld);
 }
 
 void
 spawn(const Arg *arg) {
-	signal(SIGCHLD, sigchld);
 	if(fork() == 0) {
 		if(dpy)
 			close(ConnectionNumber(dpy));