diff options
author | metalefty <meta@vmeta.jp> | 2017-01-28 21:14:55 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-28 21:14:55 +0900 |
commit | cc48345f40090bee15f304e54e4a116f5d7324d8 (patch) | |
tree | f401ec21594881435a78f3a94094649bea7564f8 /sesman/session.c | |
parent | 6257bae23f09420c7988fb04523384f1be475c9e (diff) | |
download | xrdp-proprietary-cc48345f40090bee15f304e54e4a116f5d7324d8.tar.gz xrdp-proprietary-cc48345f40090bee15f304e54e4a116f5d7324d8.zip |
sesman: remove unnecessary fork for FreeBSD (#650)
it is not only unnecessary but causes another bug.
Diffstat (limited to 'sesman/session.c')
-rw-r--r-- | sesman/session.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/sesman/session.c b/sesman/session.c index a672e93e..78d9ae9f 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -513,32 +513,23 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s) * $OpenBSD: session.c,v 1.252 2010/03/07 11:57:13 dtucker Exp $ * with some ideas about BSD process grouping to xrdp */ - pid_t bsdsespid = g_fork(); - if (bsdsespid == -1) + /** + * Create a new session and process group since the 4.4BSD + * setlogin() affects the entire process group + */ + if (g_setsid() < 0) { + log_message(LOG_LEVEL_ERROR, + "setsid failed - pid %d", g_getpid()); } - else if (bsdsespid == 0) /* BSD session leader */ - { - /** - * Create a new session and process group since the 4.4BSD - * setlogin() affects the entire process group - */ - if (g_setsid() < 0) - { - log_message(LOG_LEVEL_ERROR, - "setsid failed - pid %d", g_getpid()); - } - if (g_setlogin(s->username) < 0) - { - log_message(LOG_LEVEL_ERROR, - "setlogin failed for user %s - pid %d", s->username, - g_getpid()); - } + if (g_setlogin(s->username) < 0) + { + log_message(LOG_LEVEL_ERROR, + "setlogin failed for user %s - pid %d", s->username, + g_getpid()); } - - g_waitpid(bsdsespid); #endif wmpid = g_fork(); /* parent becomes X, child forks wm, and waits, todo */ |