aboutsummaryrefslogtreecommitdiff
path: root/sbin/init
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2006-06-08 14:04:36 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2006-06-08 14:04:36 +0000
commit5010c3b657c9497ce3e948324b487f1933bcf6eb (patch)
treeb677f0b3799cb0a9fee924ae05747bb98a1e4b78 /sbin/init
parentef753169942e9f9f07b90f7bcc55a3556f58e5b3 (diff)
Notes
Diffstat (limited to 'sbin/init')
-rw-r--r--sbin/init/init.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 393955f0abde..eb0569a17641 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1066,6 +1066,7 @@ start_window_system(session_t *sp)
pid_t pid;
sigset_t mask;
char term[64], *env[2];
+ int status;
if ((pid = fork()) == -1) {
emergency("can't fork for window system on port %s: %m",
@@ -1073,9 +1074,20 @@ start_window_system(session_t *sp)
/* hope that getty fails and we can try again */
return;
}
-
if (pid)
+ {
+ waitpid(-1, &status, 0);
return;
+ }
+
+ /* reparent window process to the init to not make a zombie on exit */
+ if ((pid = fork()) == -1) {
+ emergency("can't fork for window system on port %s: %m",
+ sp->se_device);
+ _exit(1);
+ }
+ if (pid)
+ _exit(0);
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0);