diff options
author | matt335672 <30179339+matt335672@users.noreply.github.com> | 2017-12-27 15:00:18 +0000 |
---|---|---|
committer | matt335672 <30179339+matt335672@users.noreply.github.com> | 2017-12-27 15:00:18 +0000 |
commit | 3f2a017c974c6ff0e0fbd8311cb720ae3bf8ba73 (patch) | |
tree | 2a5e6b70077716b1b1717b647feb745ecf65c1c6 /sesman | |
parent | 256fa119511e63f85b6554e1140dc26b88ad1913 (diff) | |
download | xrdp-proprietary-3f2a017c974c6ff0e0fbd8311cb720ae3bf8ba73.tar.gz xrdp-proprietary-3f2a017c974c6ff0e0fbd8311cb720ae3bf8ba73.zip |
Make listen check before daemon fork
Diffstat (limited to 'sesman')
-rw-r--r-- | sesman/sesman.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sesman/sesman.c b/sesman/sesman.c index fd98370c..609670af 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -343,18 +343,17 @@ main(int argc, char **argv) if (daemon) { /* start of daemonizing code */ - g_pid = g_fork(); + if (sesman_listen_test(g_cfg) != 0) + { - if (0 != g_pid) - { - if (sesman_listen_test(g_cfg) != 0) - { + log_message(LOG_LEVEL_ERROR, "Failed to start xrdp-sesman daemon, " + "possibly address already in use."); + g_deinit(); + g_exit(1); + } - log_message(LOG_LEVEL_ERROR, "Failed to start xrdp-sesman daemon, " - "possibly address already in use."); - g_deinit(); - g_exit(1); - } + if (0 != g_fork()) + { g_deinit(); g_exit(0); } |