summaryrefslogtreecommitdiffstats
path: root/sbin/init
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2006-06-08 14:04:36 +0000
committerkib <kib@FreeBSD.org>2006-06-08 14:04:36 +0000
commite1974d2362c17c1d4363668c87f9da1dd94ea3e5 (patch)
treeb677f0b3799cb0a9fee924ae05747bb98a1e4b78 /sbin/init
parent57a37235900f393f710b14ca62708cdd3a502ecb (diff)
downloadFreeBSD-src-e1974d2362c17c1d4363668c87f9da1dd94ea3e5.zip
FreeBSD-src-e1974d2362c17c1d4363668c87f9da1dd94ea3e5.tar.gz
Reparent the process that executes the window= command from the ttys
to the init. This prevents zombies from being accumulated. PR: bin/64198 Tested by: Eugene Grosbein <eugen at www svzserv kemerovo su> Approved by: kan (mentor) MFC after: 1 month
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 393955f..eb0569a 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);
OpenPOWER on IntegriCloud