update copyright year and don't fork if no access to pid file
This commit is contained in:
parent
bbfc60fca8
commit
8b3f3e1f19
40
xrdp/xrdp.c
40
xrdp/xrdp.c
@ -322,7 +322,7 @@ main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
g_writeln("");
|
g_writeln("");
|
||||||
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
||||||
g_writeln("Copyright (C) Jay Sorg 2004-2005");
|
g_writeln("Copyright (C) Jay Sorg 2004-2008");
|
||||||
g_writeln("See http://xrdp.sourceforge.net for more information.");
|
g_writeln("See http://xrdp.sourceforge.net for more information.");
|
||||||
g_writeln("");
|
g_writeln("");
|
||||||
g_writeln("Usage: xrdp [options]");
|
g_writeln("Usage: xrdp [options]");
|
||||||
@ -415,8 +415,9 @@ main(int argc, char** argv)
|
|||||||
no_daemon = 0;
|
no_daemon = 0;
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
if (g_strncasecmp(argv[1], "-kill", 255) == 0 ||
|
if ((g_strncasecmp(argv[1], "-kill", 255) == 0) ||
|
||||||
g_strncasecmp(argv[1], "--kill", 255) == 0)
|
(g_strncasecmp(argv[1], "--kill", 255) == 0) ||
|
||||||
|
(g_strncasecmp(argv[1], "-k", 255) == 0))
|
||||||
{
|
{
|
||||||
g_writeln("stopping xrdp");
|
g_writeln("stopping xrdp");
|
||||||
/* read the xrdp.pid file */
|
/* read the xrdp.pid file */
|
||||||
@ -459,7 +460,7 @@ main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
g_writeln("");
|
g_writeln("");
|
||||||
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
||||||
g_writeln("Copyright (C) Jay Sorg 2004-2005");
|
g_writeln("Copyright (C) Jay Sorg 2004-2008");
|
||||||
g_writeln("See http://xrdp.sourceforge.net for more information.");
|
g_writeln("See http://xrdp.sourceforge.net for more information.");
|
||||||
g_writeln("");
|
g_writeln("");
|
||||||
g_writeln("Usage: xrdp [options]");
|
g_writeln("Usage: xrdp [options]");
|
||||||
@ -469,6 +470,17 @@ main(int argc, char** argv)
|
|||||||
g_writeln("");
|
g_writeln("");
|
||||||
g_exit(0);
|
g_exit(0);
|
||||||
}
|
}
|
||||||
|
else if ((g_strncasecmp(argv[1], "-v", 255) == 0) ||
|
||||||
|
(g_strncasecmp(argv[1], "--version", 255) == 0))
|
||||||
|
{
|
||||||
|
g_writeln("");
|
||||||
|
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
||||||
|
g_writeln("Copyright (C) Jay Sorg 2004-2008");
|
||||||
|
g_writeln("See http://xrdp.sourceforge.net for more information.");
|
||||||
|
g_writeln("Version 0.5.0");
|
||||||
|
g_writeln("");
|
||||||
|
g_exit(0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_writeln("Unknown Parameter");
|
g_writeln("Unknown Parameter");
|
||||||
@ -491,6 +503,23 @@ main(int argc, char** argv)
|
|||||||
g_exit(0);
|
g_exit(0);
|
||||||
}
|
}
|
||||||
if (!no_daemon)
|
if (!no_daemon)
|
||||||
|
{
|
||||||
|
/* make sure we can write to pid file */
|
||||||
|
fd = g_file_open(XRDP_PID_FILE); /* xrdp.pid */
|
||||||
|
if (fd == -1)
|
||||||
|
{
|
||||||
|
g_writeln("running in daemon mode with no access to pid files, quitting");
|
||||||
|
g_exit(0);
|
||||||
|
}
|
||||||
|
if (g_file_write(fd, "0", 1) == -1)
|
||||||
|
{
|
||||||
|
g_writeln("running in daemon mode with no access to pid files, quitting");
|
||||||
|
g_exit(0);
|
||||||
|
}
|
||||||
|
g_file_close(fd);
|
||||||
|
g_file_delete(XRDP_PID_FILE);
|
||||||
|
}
|
||||||
|
if (!no_daemon)
|
||||||
{
|
{
|
||||||
/* start of daemonizing code */
|
/* start of daemonizing code */
|
||||||
pid = g_fork();
|
pid = g_fork();
|
||||||
@ -514,6 +543,8 @@ main(int argc, char** argv)
|
|||||||
g_file_open("/dev/null");
|
g_file_open("/dev/null");
|
||||||
/* end of daemonizing code */
|
/* end of daemonizing code */
|
||||||
}
|
}
|
||||||
|
if (!no_daemon)
|
||||||
|
{
|
||||||
/* write the pid to file */
|
/* write the pid to file */
|
||||||
pid = g_getpid();
|
pid = g_getpid();
|
||||||
fd = g_file_open(XRDP_PID_FILE); /* xrdp.pid */
|
fd = g_file_open(XRDP_PID_FILE); /* xrdp.pid */
|
||||||
@ -530,6 +561,7 @@ main(int argc, char** argv)
|
|||||||
g_file_write(fd, text, g_strlen(text));
|
g_file_write(fd, text, g_strlen(text));
|
||||||
g_file_close(fd);
|
g_file_close(fd);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
g_threadid = tc_get_threadid();
|
g_threadid = tc_get_threadid();
|
||||||
g_listen = xrdp_listen_create();
|
g_listen = xrdp_listen_create();
|
||||||
|
Loading…
Reference in New Issue
Block a user