Merge pull request #222 from metalefty/issue-33

xrdp: fix -h -v option if xrdp.ini is invalid
ulab-next-nosound
jsorg71 10 years ago
commit 4a6567c5a2

@ -319,7 +319,6 @@ main(int argc, char **argv)
test = 1;
host_be = !((int)(*(unsigned char *)(&test)));
#if defined(B_ENDIAN)
if (!host_be)
#endif
#if defined(L_ENDIAN)
@ -357,6 +356,51 @@ main(int argc, char **argv)
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
startup_params = (struct xrdp_startup_params *)
g_malloc(sizeof(struct xrdp_startup_params), 1);
if (xrdp_process_params(argc, argv, startup_params) != 0)
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
g_writeln("");
g_deinit();
g_exit(0);
}
g_snprintf(pid_file, 255, "%s/xrdp.pid", XRDP_PID_PATH);
no_daemon = 0;
if (startup_params->help)
{
g_writeln("");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://www.xrdp.org for more information.");
g_writeln("");
g_writeln("Usage: xrdp [options]");
g_writeln(" --help: show help");
g_writeln(" --nodaemon: don't fork into background");
g_writeln(" --kill: shut down xrdp");
g_writeln(" --port: tcp listen port");
g_writeln(" --fork: fork on new connection");
g_writeln("");
g_deinit();
g_exit(0);
}
if (startup_params->version)
{
g_writeln("");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://www.xrdp.org for more information.");
g_writeln("Version %s", PACKAGE_VERSION);
g_writeln("");
g_deinit();
g_exit(0);
}
/* starting logging subsystem */
error = log_start(cfg_file, "XRDP");
@ -380,21 +424,16 @@ main(int argc, char **argv)
g_exit(1);
}
startup_params = (struct xrdp_startup_params *)
g_malloc(sizeof(struct xrdp_startup_params), 1);
if (xrdp_process_params(argc, argv, startup_params) != 0)
if (g_file_exist(pid_file)) /* xrdp.pid */
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
g_writeln("");
g_writeln("It looks like xrdp is allready running,");
g_writeln("if not delete the xrdp.pid file and try again");
g_deinit();
g_exit(0);
}
g_snprintf(pid_file, 255, "%s/xrdp.pid", XRDP_PID_PATH);
no_daemon = 0;
if (startup_params->kill)
{
g_writeln("stopping xrdp");
@ -435,43 +474,6 @@ main(int argc, char **argv)
no_daemon = 1;
}
if (startup_params->help)
{
g_writeln("");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://www.xrdp.org for more information.");
g_writeln("");
g_writeln("Usage: xrdp [options]");
g_writeln(" --help: show help");
g_writeln(" --nodaemon: don't fork into background");
g_writeln(" --kill: shut down xrdp");
g_writeln(" --port: tcp listen port");
g_writeln(" --fork: fork on new connection");
g_writeln("");
g_deinit();
g_exit(0);
}
if (startup_params->version)
{
g_writeln("");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://www.xrdp.org for more information.");
g_writeln("Version %s", PACKAGE_VERSION);
g_writeln("");
g_deinit();
g_exit(0);
}
if (g_file_exist(pid_file)) /* xrdp.pid */
{
g_writeln("It looks like xrdp is allready running,");
g_writeln("if not delete the xrdp.pid file and try again");
g_deinit();
g_exit(0);
}
if (!no_daemon)
{

Loading…
Cancel
Save