Date: Thu, 29 Dec 2005 13:40:09 GMT From: Kostik Belousov <kostikbel@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/64198: init(8) may keep zombies Message-ID: <200512291340.jBTDe9CE002800@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/64198; it has been noted by GNATS. From: Kostik Belousov <kostikbel@gmail.com> To: bug-followup@FreeBSD.org, eugen@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512291340.jBTDe9CE002800>