bin/64198: init(8) may keep zombies
Kostik Belousov
kostikbel at gmail.com
Thu Dec 29 05:40:20 PST 2005
The following reply was made to PR bin/64198; it has been noted by GNATS.
From: Kostik Belousov <kostikbel at gmail.com>
To: bug-followup at FreeBSD.org, eugen at grosbein.pp.ru
Cc:
Subject: Re: bin/64198: init(8) may keep zombies
Date: Thu, 29 Dec 2005 15:35:23 +0200
The following patch fixes cosmetic problem with zombie.
For RE state in ps output, see PR/91044.
Index: sbin/init/init.c
===================================================================
RCS file: /usr/local/arch/ncvs/src/sbin/init/init.c,v
retrieving revision 1.61
diff -u -r1.61 init.c
--- sbin/init/init.c 15 Sep 2005 13:16:07 -0000 1.61
+++ sbin/init/init.c 28 Dec 2005 15:56:06 -0000
@@ -1066,6 +1066,7 @@
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 @@
/* 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);
More information about the freebsd-bugs
mailing list