summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dwm.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/dwm.c b/dwm.c
index 3fb00d2..b390294 100644
--- a/dwm.c
+++ b/dwm.c
@@ -182,6 +182,7 @@ 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);
185static void spawn(const Arg *arg); 186static void spawn(const Arg *arg);
186static void tag(const Arg *arg); 187static void tag(const Arg *arg);
187static int textnw(const char *text, unsigned int len); 188static int textnw(const char *text, unsigned int len);
@@ -1391,22 +1392,24 @@ showhide(Client *c) {
1391 } 1392 }
1392} 1393}
1393 1394
1395
1396void
1397sigchld(int signal) {
1398 while(0 < waitpid(-1, NULL, WNOHANG));
1399}
1400
1394void 1401void
1395spawn(const Arg *arg) { 1402spawn(const Arg *arg) {
1396 /* The double-fork construct avoids zombie processes and keeps the code 1403 signal(SIGCHLD, sigchld);
1397 * clean from stupid signal handlers. */
1398 if(fork() == 0) { 1404 if(fork() == 0) {
1399 if(fork() == 0) { 1405 if(dpy)
1400 if(dpy) 1406 close(ConnectionNumber(dpy));
1401 close(ConnectionNumber(dpy)); 1407 setsid();
1402 setsid(); 1408 execvp(((char **)arg->v)[0], (char **)arg->v);
1403 execvp(((char **)arg->v)[0], (char **)arg->v); 1409 fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
1404 fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); 1410 perror(" failed");
1405 perror(" failed");
1406 }
1407 exit(0); 1411 exit(0);
1408 } 1412 }
1409 wait(0);
1410} 1413}
1411 1414
1412void 1415void
@@ -1455,14 +1458,8 @@ tile(void) {
1455 h = wh; 1458 h = wh;
1456 1459
1457 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { 1460 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
1458 if(i + 1 == n) { /* remainder */ 1461 resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
1459 if(wy + wh - y < bh) 1462 ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints);
1460 resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, False);
1461 else
1462 resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, resizehints);
1463 }
1464 else
1465 resize(c, x, y, w - 2 * c->bw, h - 2 * c->bw, resizehints);
1466 if(h != wh) 1463 if(h != wh)
1467 y = c->y + HEIGHT(c); 1464 y = c->y + HEIGHT(c);
1468 } 1465 }