key.c: fix zombie terminal processes
This commit is contained in:
parent
4d0f0f62da
commit
d1a8d31b45
1 changed files with 21 additions and 14 deletions
13
key.c
13
key.c
|
@ -6,6 +6,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -782,9 +783,11 @@ void keypress(XKeyEvent* e) {
|
|||
else if (e->keycode == slcode && (e->state & SHORTCUTMOD) == (MODBITS)) {
|
||||
kbLaunch = 1;
|
||||
if (fork() == 0) {
|
||||
close(ConnectionNumber(dpy));
|
||||
if (dpy != '\0')
|
||||
putenv(dpy);
|
||||
if (fork() == 0) {
|
||||
// this code doesn't seem necessary
|
||||
// close(ConnectionNumber(dpy));
|
||||
// if (dpy != '\0')
|
||||
// putenv(dpy);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGTERM, SIG_DFL);
|
||||
signal(SIGHUP, SIG_DFL);
|
||||
|
@ -797,7 +800,11 @@ void keypress(XKeyEvent* e) {
|
|||
execlp("9term", "9term", scrolling ? "-ws" : "-w", (char*)0);
|
||||
execlp("xterm", "xterm", "-ut", (char*)0);
|
||||
perror("ryudo: exec urxvt/9term/xterm failed");
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
wait((int*)0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue