summaryrefslogtreecommitdiffstats
path: root/sesman/sesman.c
diff options
context:
space:
mode:
Diffstat (limited to 'sesman/sesman.c')
-rw-r--r--sesman/sesman.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sesman/sesman.c b/sesman/sesman.c
index a89d2f55..7aa098fc 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -209,8 +209,7 @@ main(int argc, char **argv)
if (1 == argc)
{
- /* no options on command line. normal startup */
- g_printf("starting sesman...\n");
+ /* start in daemon mode if no cli options */
daemon = 1;
}
else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--nodaemon")) ||
@@ -312,6 +311,12 @@ main(int argc, char **argv)
g_exit(1);
}
+ /* not to spit on the console, show config summary only when running in foreground */
+ if (!daemon)
+ {
+ config_dump(g_cfg);
+ }
+
g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH);
/* starting logging subsystem */
@@ -337,9 +342,18 @@ main(int argc, char **argv)
g_exit(1);
}
+ if (daemon)
+ {
+ /* not to spit on the console, shut up stdout/stderr before anything's logged */
+ g_file_close(0);
+ g_file_close(1);
+ g_file_close(2);
+ }
+
/* libscp initialization */
scp_init();
+
if (daemon)
{
/* start of daemonizing code */
@@ -358,10 +372,6 @@ main(int argc, char **argv)
g_exit(0);
}
- g_file_close(0);
- g_file_close(1);
- g_file_close(2);
-
if (g_file_open("/dev/null") < 0)
{
}