--- /dev/null
+Ensure that the PID file is written before sleeping.
+
+Index: xrdp/xrdp/xrdp.c
+===================================================================
+--- xrdp.orig/xrdp/xrdp.c 2012-09-29 13:03:27.666630538 +0200
++++ xrdp/xrdp/xrdp.c 2012-09-29 13:03:32.874746622 +0200
+@@ -388,17 +388,6 @@
+ g_deinit();
+ 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 */
+@@ -414,6 +403,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 */
+ }
+ g_threadid = tc_get_threadid();
+ g_listen = xrdp_listen_create();
--- /dev/null
+Avoid displaying a lot of information when starting xrdp and sesman
+
+Index: xrdp/sesman/config.c
+===================================================================
+--- xrdp.orig/sesman/config.c 2012-09-29 12:51:50.000000000 +0200
++++ xrdp/sesman/config.c 2012-09-29 12:55:57.560560996 +0200
+@@ -179,13 +179,13 @@
+ }
+
+ /* showing read config */
+- g_printf("sesman config:\r\n");
++ /* g_printf("sesman config:\r\n");
+ g_printf("\tListenAddress: %s\r\n", cf->listen_address);
+ g_printf("\tListenPort: %s\r\n", cf->listen_port);
+ g_printf("\tEnableUserWindowManager: %i\r\n", cf->enable_user_wm);
+ g_printf("\tUserWindowManager: %s\r\n", cf->user_wm);
+ g_printf("\tDefaultWindowManager: %s\r\n", cf->default_wm);
+- g_printf("\tAuthFilePath: %s\r\n", ((cf->auth_file_path) ? (cf->auth_file_path) : ("disabled")));
++ g_printf("\tAuthFilePath: %s\r\n", ((cf->auth_file_path) ? (cf->auth_file_path) : ("disabled"))); */
+
+ return 0;
+ }
+@@ -236,11 +236,11 @@
+ lc->log_file=g_strdup("./sesman.log");
+ }
+
+- g_printf("logging configuration:\r\n");
++ /* g_printf("logging configuration:\r\n");
+ g_printf("\tLogFile: %s\r\n",lc->log_file);
+ g_printf("\tLogLevel: %i\r\n", lc->log_level);
+ g_printf("\tEnableSyslog: %i\r\n", lc->enable_syslog);
+- g_printf("\tSyslogLevel: %i\r\n", lc->syslog_level);
++ g_printf("\tSyslogLevel: %i\r\n", lc->syslog_level); */
+
+ return 0;
+ }
+@@ -295,7 +295,7 @@
+ }
+
+ /* printing security config */
+- g_printf("security configuration:\r\n");
++ /* g_printf("security configuration:\r\n");
+ g_printf("\tAllowRootLogin: %i\r\n",sc->allow_root);
+ g_printf("\tMaxLoginRetry: %i\r\n",sc->login_retry);
+ if (sc->ts_users_enable)
+@@ -313,7 +313,7 @@
+ else
+ {
+ g_printf("\tNo TSAdminsGroup defined\r\n");
+- }
++ } */
+
+ return 0;
+ }
+@@ -363,12 +363,12 @@
+ }
+
+ /* printing security config */
+- g_printf("session configuration:\r\n");
++ /* g_printf("session configuration:\r\n");
+ g_printf("\tMaxSessions: %i\r\n", se->max_sessions);
+ g_printf("\tX11DisplayOffset: %i\r\n", se->x11_display_offset);
+ g_printf("\tKillDisconnected: %i\r\n", se->kill_disconnected);
+ g_printf("\tIdleTimeLimit: %i\r\n", se->max_idle_time);
+- g_printf("\tDisconnectedTimeLimit: %i\r\n", se->max_idle_time);
++ g_printf("\tDisconnectedTimeLimit: %i\r\n", se->max_idle_time); */
+
+ return 0;
+ }
+@@ -392,11 +392,11 @@
+ }
+
+ /* printing security config */
+- g_printf("X11rdp parameters:\r\n");
++ /* g_printf("X11rdp parameters:\r\n");
+ for (i = 0; i < cs->rdp_params->count; i++)
+ {
+ g_printf("\tParameter %02d %s\r\n", i, (char*)list_get_item(cs->rdp_params, i));
+- }
++ } */
+
+ return 0;
+ }
+@@ -420,11 +420,11 @@
+ }
+
+ /* printing security config */
+- g_printf("Xvnc parameters:\r\n");
++ /* g_printf("Xvnc parameters:\r\n");
+ for (i = 0; i < cs->vnc_params->count; i++)
+ {
+ g_printf("\tParameter %02d %s\r\n", i, (char*)list_get_item(cs->vnc_params, i));
+- }
++ } */
+
+ return 0;
+ }
+Index: xrdp/sesman/sesman.c
+===================================================================
+--- xrdp.orig/sesman/sesman.c 2012-09-29 12:51:50.000000000 +0200
++++ xrdp/sesman/sesman.c 2012-09-29 12:55:11.103556585 +0200
+@@ -143,7 +143,7 @@
+ if (1 == argc)
+ {
+ /* no options on command line. normal startup */
+- g_printf("starting sesman...\n");
++ /* g_printf("starting sesman...\n"); */
+ daemon = 1;
+ }
+ else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--nodaemon")) ||
+Index: xrdp/xrdp/xrdp.c
+===================================================================
+--- xrdp.orig/xrdp/xrdp.c 2012-09-29 12:51:50.000000000 +0200
++++ xrdp/xrdp/xrdp.c 2012-09-29 12:55:11.103556585 +0200
+@@ -383,7 +383,7 @@
+ }
+ if (0 != pid)
+ {
+- g_writeln("process %d started ok", pid);
++ /* g_writeln("process %d started ok", pid); */
+ /* exit, this is the main process */
+ g_deinit();
+ g_exit(0);
+Index: xrdp/sesman/libscp/libscp_init.c
+===================================================================
+--- xrdp.orig/sesman/libscp/libscp_init.c 2012-09-29 12:51:50.111200358 +0200
++++ xrdp/sesman/libscp/libscp_init.c 2012-09-29 12:55:11.103556585 +0200
+@@ -42,8 +42,6 @@
+
+ scp_lock_init();
+
+- log_message(s_log, LOG_LEVEL_WARNING, "[init:%d] libscp initialized", __LINE__);
+-
+ return 0;
+ }
+