summaryrefslogtreecommitdiffstats
path: root/sesman/sesman.c
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2009-05-19 04:23:49 +0000
committerjsorg71 <jsorg71>2009-05-19 04:23:49 +0000
commit23ffdb0c5fe0315d9d237f168e7d72abe0ba422c (patch)
tree9c565ce9f75c1aab5329837d209af63a9dd74a54 /sesman/sesman.c
parenta386eac0f931716e421e20a7cc07c2f0b4e70a2f (diff)
downloadxrdp-proprietary-23ffdb0c5fe0315d9d237f168e7d72abe0ba422c.tar.gz
xrdp-proprietary-23ffdb0c5fe0315d9d237f168e7d72abe0ba422c.zip
autotools fix and file_loc.h simplified
Diffstat (limited to 'sesman/sesman.c')
-rw-r--r--sesman/sesman.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sesman/sesman.c b/sesman/sesman.c
index 4ce3cdfd..4fc038de 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -134,7 +134,9 @@ main(int argc, char** argv)
int pid;
char pid_s[8];
char text[256];
+ char pid_file[256];
+ g_snprintf(pid_file, 255, "%s/xrdp-sesman.pid", XRDP_PID_PATH);
if (1 == argc)
{
/* no options on command line. normal startup */
@@ -167,18 +169,17 @@ main(int argc, char** argv)
{
/* killing running sesman */
/* check if sesman is running */
- if (!g_file_exist(SESMAN_PID_FILE))
+ if (!g_file_exist(pid_file))
{
- g_printf("sesman is not running (pid file not found - %s)\n",
- SESMAN_PID_FILE);
+ g_printf("sesman is not running (pid file not found - %s)\n", pid_file);
g_exit(1);
}
- fd = g_file_open(SESMAN_PID_FILE);
+ fd = g_file_open(pid_file);
if (-1 == fd)
{
- g_printf("error opening pid file[%s]: %s\n", SESMAN_PID_FILE, g_get_strerror());
+ g_printf("error opening pid file[%s]: %s\n", pid_file, g_get_strerror());
return 1;
}
@@ -199,7 +200,7 @@ main(int argc, char** argv)
}
else
{
- g_file_delete(SESMAN_PID_FILE);
+ g_file_delete(pid_file);
}
g_exit(error);
@@ -213,11 +214,11 @@ main(int argc, char** argv)
g_exit(1);
}
- if (g_file_exist(SESMAN_PID_FILE))
+ if (g_file_exist(pid_file))
{
g_printf("sesman is already running.\n");
g_printf("if it's not running, try removing ");
- g_printf(SESMAN_PID_FILE);
+ g_printf(pid_file);
g_printf("\n");
g_exit(1);
}
@@ -298,17 +299,17 @@ main(int argc, char** argv)
if (daemon)
{
/* writing pid file */
- fd = g_file_open(SESMAN_PID_FILE);
+ fd = g_file_open(pid_file);
if (-1 == fd)
{
log_message(&(g_cfg->log), LOG_LEVEL_ERROR,
"error opening pid file[%s]: %s",
- SESMAN_PID_FILE, g_get_strerror());
+ pid_file, g_get_strerror());
log_end(&(g_cfg->log));
g_exit(1);
}
g_sprintf(pid_s, "%d", g_pid);
- g_file_write(fd, pid_s, g_strlen(pid_s) + 1);
+ g_file_write(fd, pid_s, g_strlen(pid_s));
g_file_close(fd);
}