diff options
| author | arg@localhost.localdomain <unknown> | 2008-12-06 09:16:48 +0000 |
|---|---|---|
| committer | arg@localhost.localdomain <unknown> | 2008-12-06 09:16:48 +0000 |
| commit | e7572804faa9a21a57ae298c2b153ff92d8a64ff (patch) | |
| tree | b02a0ec1d467412b6395622447412d4ff0b45427 | |
| parent | Added tag 5.3 for changeset 4004d6116035 (diff) | |
| download | dwm-e7572804faa9a21a57ae298c2b153ff92d8a64ff.tar.gz dwm-e7572804faa9a21a57ae298c2b153ff92d8a64ff.zip | |
reverted spawn
| -rw-r--r-- | dwm.c | 25 |
1 files changed, 11 insertions, 14 deletions
| @@ -182,7 +182,6 @@ static void setlayout(const Arg *arg); | |||
| 182 | static void setmfact(const Arg *arg); | 182 | static void setmfact(const Arg *arg); |
| 183 | static void setup(void); | 183 | static void setup(void); |
| 184 | static void showhide(Client *c); | 184 | static void showhide(Client *c); |
| 185 | static void sigchld(int signal); | ||
| 186 | static void spawn(const Arg *arg); | 185 | static void spawn(const Arg *arg); |
| 187 | static void tag(const Arg *arg); | 186 | static void tag(const Arg *arg); |
| 188 | static int textnw(const char *text, unsigned int len); | 187 | static int textnw(const char *text, unsigned int len); |
| @@ -1392,24 +1391,22 @@ showhide(Client *c) { | |||
| 1392 | } | 1391 | } |
| 1393 | } | 1392 | } |
| 1394 | 1393 | ||
| 1395 | |||
| 1396 | void | ||
| 1397 | sigchld(int signal) { | ||
| 1398 | while(0 < waitpid(-1, NULL, WNOHANG)); | ||
| 1399 | } | ||
| 1400 | |||
| 1401 | void | 1394 | void |
| 1402 | spawn(const Arg *arg) { | 1395 | spawn(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 | ||
| 1415 | void | 1412 | void |
