diff options
author | Nicola Ruggero <nicola@nxnt.org> | 2010-11-03 16:59:26 +0100 |
---|---|---|
committer | Nicola Ruggero <nicola@nxnt.org> | 2010-11-03 16:59:26 +0100 |
commit | 4cf06dbbcb8522be5fa069976c8f361fc874039f (patch) | |
tree | 6e074a89c4edadf9a75d648d1f9daf36079c03aa /xrdp/xrdp.c | |
parent | 104f762e5d3dcd659415632f442e745cef5a3bf2 (diff) | |
download | xrdp-proprietary-4cf06dbbcb8522be5fa069976c8f361fc874039f.tar.gz xrdp-proprietary-4cf06dbbcb8522be5fa069976c8f361fc874039f.zip |
Major code cleanup:
- Initialized and zeroed out local variables
- Check for some null pointers
- Fixed some typos
- Other minor changes (beautify, etc.)
Diffstat (limited to 'xrdp/xrdp.c')
-rw-r--r-- | xrdp/xrdp.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c index 994af47c..c354be6b 100644 --- a/xrdp/xrdp.c +++ b/xrdp/xrdp.c @@ -350,7 +350,7 @@ main(int argc, char** argv) g_writeln("error OpenSCManager, do you have rights?"); g_exit(0); } - /* check if service is already installed */ + /* check if service is allready installed */ sc_ser = OpenService(sc_man, "xrdp", SERVICE_ALL_ACCESS); if (sc_ser == 0) { @@ -363,7 +363,7 @@ main(int argc, char** argv) } else { - g_writeln("error service is already installed"); + g_writeln("error service is allready installed"); CloseServiceHandle(sc_ser); CloseServiceHandle(sc_man); g_exit(0); @@ -382,7 +382,7 @@ main(int argc, char** argv) g_writeln("error OpenSCManager, do you have rights?"); g_exit(0); } - /* check if service is already installed */ + /* check if service is allready installed */ sc_ser = OpenService(sc_man, "xrdp", SERVICE_ALL_ACCESS); if (sc_ser == 0) { @@ -506,7 +506,7 @@ main(int argc, char** argv) } if (g_file_exist(pid_file)) /* xrdp.pid */ { - g_writeln("It looks like xrdp is already running,"); + g_writeln("It looks like xrdp is allready running,"); g_writeln("if not delete the xrdp.pid file and try again"); g_exit(0); } @@ -542,6 +542,17 @@ main(int argc, char** argv) /* 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 */ @@ -557,14 +568,6 @@ main(int argc, char** argv) 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(); |