FreeBSD: rework setsid code
Pull request #650 is not valid to avoid run session twice. It certainly stops running session twice but causes #1016. In FreeBSD, sesman process will run like this. The intermediate sesman is needed to detect session termination correctly. xrdp-sesman (daemon) | +- xrdp-sesman (FreeBSD specific intermediate sesman) | +- xrdp-sesman (bsd sesion leader & each session) | +- Xorg +- startwm.sh +- xrdp-chansrv To stop runninng session twice correctly, just exit before the intermediate sesman executes Xorg, WM and chansrv.
This commit is contained in:
parent
4cee6726f8
commit
c50015122c
@ -484,7 +484,13 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
|||||||
* $OpenBSD: session.c,v 1.252 2010/03/07 11:57:13 dtucker Exp $
|
* $OpenBSD: session.c,v 1.252 2010/03/07 11:57:13 dtucker Exp $
|
||||||
* with some ideas about BSD process grouping to xrdp
|
* with some ideas about BSD process grouping to xrdp
|
||||||
*/
|
*/
|
||||||
|
pid_t bsdsespid = g_fork();
|
||||||
|
|
||||||
|
if (bsdsespid == -1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else if (bsdsespid == 0) /* BSD session leader */
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new session and process group since the 4.4BSD
|
* Create a new session and process group since the 4.4BSD
|
||||||
* setlogin() affects the entire process group
|
* setlogin() affects the entire process group
|
||||||
@ -501,6 +507,18 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
|||||||
"setlogin failed for user %s - pid %d", s->username,
|
"setlogin failed for user %s - pid %d", s->username,
|
||||||
g_getpid());
|
g_getpid());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_waitpid(bsdsespid);
|
||||||
|
|
||||||
|
if (bsdsespid > 0)
|
||||||
|
{
|
||||||
|
g_exit(0);
|
||||||
|
/*
|
||||||
|
* intermediate sesman should exit here after WM exits.
|
||||||
|
* do not execure the following codes.
|
||||||
|
*/
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
window_manager_pid = g_fork(); /* parent becomes X,
|
window_manager_pid = g_fork(); /* parent becomes X,
|
||||||
child forks wm, and waits, todo */
|
child forks wm, and waits, todo */
|
||||||
|
Loading…
Reference in New Issue
Block a user