summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dwm.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/dwm.c b/dwm.c
index b390294..f7b9477 100644
--- a/dwm.c
+++ b/dwm.c
@@ -182,7 +182,6 @@ static void setlayout(const Arg *arg);
182static void setmfact(const Arg *arg); 182static void setmfact(const Arg *arg);
183static void setup(void); 183static void setup(void);
184static void showhide(Client *c); 184static void showhide(Client *c);
185static void sigchld(int signal);
186static void spawn(const Arg *arg); 185static void spawn(const Arg *arg);
187static void tag(const Arg *arg); 186static void tag(const Arg *arg);
188static int textnw(const char *text, unsigned int len); 187static int textnw(const char *text, unsigned int len);
@@ -1392,24 +1391,22 @@ showhide(Client *c) {
1392 } 1391 }
1393} 1392}
1394 1393
1395
1396void
1397sigchld(int signal) {
1398 while(0 < waitpid(-1, NULL, WNOHANG));
1399}
1400
1401void 1394void
1402spawn(const Arg *arg) { 1395spawn(const Arg *arg) {
1403 signal(SIGCHLD, sigchld); 1396 /* The double-fork construct avoids zombie processes and keeps the code
1397 * clean from stupid signal handlers. */
1404 if(fork() == 0) { 1398 if(fork() == 0) {
1405 if(dpy) 1399 if(fork() == 0) {
1406 close(ConnectionNumber(dpy)); 1400 if(dpy)
1407 setsid(); 1401 close(ConnectionNumber(dpy));
1408 execvp(((char **)arg->v)[0], (char **)arg->v); 1402 setsid();
1409 fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); 1403 execvp(((char **)arg->v)[0], (char **)arg->v);
1410 perror(" failed"); 1404 fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
1405 perror(" failed");
1406 }
1411 exit(0); 1407 exit(0);
1412 } 1408 }
1409 wait(0);
1413} 1410}
1414 1411
1415void 1412void