Package: xrdp / 0.5.0-2

06-xrdp_pidfile_early.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Ensure that the PID file is written before sleeping.

--- a/xrdp/xrdp.c.orig	2010-07-20 20:18:15.000000000 +0200
+++ a/xrdp/xrdp.c	2010-07-20 20:18:48.000000000 +0200
@@ -537,17 +537,6 @@
       /* exit, this is the main process */
       g_exit(0);
     }
-    g_sleep(1000);
-    g_file_close(0);
-    g_file_close(1);
-    g_file_close(2);
-    g_file_open("/dev/null");
-    g_file_open("/dev/null");
-    g_file_open("/dev/null");
-    /* end of daemonizing code */
-  }
-  if (!no_daemon)
-  {
     /* write the pid to file */
     pid = g_getpid();
     fd = g_file_open(pid_file); /* xrdp.pid */
@@ -563,6 +552,14 @@
       g_file_write(fd, text, g_strlen(text));
       g_file_close(fd);
     }
+    g_sleep(1000);
+    g_file_close(0);
+    g_file_close(1);
+    g_file_close(2);
+    g_file_open("/dev/null");
+    g_file_open("/dev/null");
+    g_file_open("/dev/null");
+    /* end of daemonizing code */
   }
 #endif
   g_threadid = tc_get_threadid();