summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorKoichiro IWAO <meta@vmeta.jp>2018-06-01 22:44:51 +0900
committerKoichiro IWAO <meta@vmeta.jp>2018-06-05 00:19:36 +0900
commit2262f1361f86292e767f9a62c4ee42d65a3485cb (patch)
tree16ec434a82646f5e56bbedc6bf7a82ebff45d6fd /sesman
parent6ae3052a0f0c87393977264f9d19f168e4bfe02a (diff)
downloadxrdp-proprietary-2262f1361f86292e767f9a62c4ee42d65a3485cb.tar.gz
xrdp-proprietary-2262f1361f86292e767f9a62c4ee42d65a3485cb.zip
sesman: close stdout/stderr earlier
not to spit on the console
Diffstat (limited to 'sesman')
-rw-r--r--sesman/sesman.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sesman/sesman.c b/sesman/sesman.c
index 8abdc4ac..7aa098fc 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -342,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 */
@@ -363,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)
{
}