mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-01 08:33:24 +00:00
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
This commit is contained in:
parent
ef75316994
commit
5010c3b657
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159402
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user