]> TLD Linux GIT Repositories - packages/xrdp.git/blob - pidfile_early.patch
- patches from debian
[packages/xrdp.git] / pidfile_early.patch
1 Ensure that the PID file is written before sleeping.
2
3 Index: xrdp/xrdp/xrdp.c
4 ===================================================================
5 --- xrdp.orig/xrdp/xrdp.c       2012-09-29 13:03:27.666630538 +0200
6 +++ xrdp/xrdp/xrdp.c    2012-09-29 13:03:32.874746622 +0200
7 @@ -388,17 +388,6 @@
8        g_deinit();
9        g_exit(0);
10      }
11 -    g_sleep(1000);
12 -    g_file_close(0);
13 -    g_file_close(1);
14 -    g_file_close(2);
15 -    g_file_open("/dev/null");
16 -    g_file_open("/dev/null");
17 -    g_file_open("/dev/null");
18 -    /* end of daemonizing code */
19 -  }
20 -  if (!no_daemon)
21 -  {
22      /* write the pid to file */
23      pid = g_getpid();
24      fd = g_file_open(pid_file); /* xrdp.pid */
25 @@ -414,6 +403,14 @@
26        g_file_write(fd, text, g_strlen(text));
27        g_file_close(fd);
28      }
29 +    g_sleep(1000);
30 +    g_file_close(0);
31 +    g_file_close(1);
32 +    g_file_close(2);
33 +    g_file_open("/dev/null");
34 +    g_file_open("/dev/null");
35 +    g_file_open("/dev/null");
36 +    /* end of daemonizing code */
37    }
38    g_threadid = tc_get_threadid();
39    g_listen = xrdp_listen_create();