diff options
author | jsorg71 <jsorg71> | 2009-05-19 04:23:49 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2009-05-19 04:23:49 +0000 |
commit | 23ffdb0c5fe0315d9d237f168e7d72abe0ba422c (patch) | |
tree | 9c565ce9f75c1aab5329837d209af63a9dd74a54 /sesman | |
parent | a386eac0f931716e421e20a7cc07c2f0b4e70a2f (diff) | |
download | xrdp-proprietary-23ffdb0c5fe0315d9d237f168e7d72abe0ba422c.tar.gz xrdp-proprietary-23ffdb0c5fe0315d9d237f168e7d72abe0ba422c.zip |
autotools fix and file_loc.h simplified
Diffstat (limited to 'sesman')
-rw-r--r-- | sesman/Makefile.am | 7 | ||||
-rw-r--r-- | sesman/chansrv/Makefile.am | 7 | ||||
-rw-r--r-- | sesman/config.c | 8 | ||||
-rw-r--r-- | sesman/config.h | 10 | ||||
-rw-r--r-- | sesman/libscp/Makefile.am | 7 | ||||
-rw-r--r-- | sesman/sesman.c | 23 | ||||
-rw-r--r-- | sesman/sesman.h | 4 | ||||
-rw-r--r-- | sesman/sessvc/Makefile.am | 7 | ||||
-rw-r--r-- | sesman/sig.c | 5 | ||||
-rw-r--r-- | sesman/tools/Makefile.am | 7 |
10 files changed, 56 insertions, 29 deletions
diff --git a/sesman/Makefile.am b/sesman/Makefile.am index c5f4643a..95149427 100644 --- a/sesman/Makefile.am +++ b/sesman/Makefile.am @@ -1,3 +1,10 @@ + +AM_CFLAGS = \ + -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ + -DXRDP_SBIN_PATH=\"${sbindir}\" \ + -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ + -DXRDP_PID_PATH=\"${localstatedir}/run\" + INCLUDES = \ -I$(top_srcdir)/common \ -I$(top_srcdir)/sesman/libscp diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am index 8752e737..fb4e8984 100644 --- a/sesman/chansrv/Makefile.am +++ b/sesman/chansrv/Makefile.am @@ -1,3 +1,10 @@ + +AM_CFLAGS = \ + -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ + -DXRDP_SBIN_PATH=\"${sbindir}\" \ + -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ + -DXRDP_PID_PATH=\"${localstatedir}/run\" + INCLUDES = \ -I$(top_srcdir)/common diff --git a/sesman/config.c b/sesman/config.c index 4af7b696..d24661e3 100644 --- a/sesman/config.c +++ b/sesman/config.c @@ -60,19 +60,21 @@ config_read(struct config_sesman* cfg) struct list* sec; struct list* param_n; struct list* param_v; + char cfg_file[256]; - fd = g_file_open(SESMAN_CFG_FILE); + g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH); + fd = g_file_open(cfg_file); if (-1 == fd) { if (g_cfg->log.fd >= 0) { /* logging is already active */ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "error opening %s in \ - config_read", SESMAN_CFG_FILE); + config_read", cfg_file); } else { - g_printf("error opening %s in config_read", SESMAN_CFG_FILE); + g_printf("error opening %s in config_read", cfg_file); } return 1; } diff --git a/sesman/config.h b/sesman/config.h index 11b3e586..cfe7c65e 100644 --- a/sesman/config.h +++ b/sesman/config.h @@ -32,16 +32,6 @@ #include "list.h" #include "log.h" -/** - * - * @def SESMAN_CFG_FILE - * @brief Configuration file path - * - */ -#ifndef SESMAN_CFG_FILE -#define SESMAN_CFG_FILE "./sesman.ini" -#endif - #define SESMAN_CFG_GLOBALS "Globals" #define SESMAN_CFG_DEFWM "DefaultWindowManager" #define SESMAN_CFG_ADDRESS "ListenAddress" diff --git a/sesman/libscp/Makefile.am b/sesman/libscp/Makefile.am index f0b87a7b..e1784f82 100644 --- a/sesman/libscp/Makefile.am +++ b/sesman/libscp/Makefile.am @@ -1,3 +1,10 @@ + +AM_CFLAGS = \ + -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ + -DXRDP_SBIN_PATH=\"${sbindir}\" \ + -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ + -DXRDP_PID_PATH=\"${localstatedir}/run\" + INCLUDES = \ -I$(top_srcdir)/common 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); } diff --git a/sesman/sesman.h b/sesman/sesman.h index c62a2bbe..0344ccd5 100644 --- a/sesman/sesman.h +++ b/sesman/sesman.h @@ -51,8 +51,4 @@ #include "libscp.h" -#ifndef SESMAN_PID_FILE - #define SESMAN_PID_FILE "./sesman.pid" -#endif - #endif diff --git a/sesman/sessvc/Makefile.am b/sesman/sessvc/Makefile.am index d8897d2c..67740781 100644 --- a/sesman/sessvc/Makefile.am +++ b/sesman/sessvc/Makefile.am @@ -1,3 +1,10 @@ + +AM_CFLAGS = \ + -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ + -DXRDP_SBIN_PATH=\"${sbindir}\" \ + -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ + -DXRDP_PID_PATH=\"${localstatedir}/run\" + INCLUDES = \ -I$(top_srcdir)/common diff --git a/sesman/sig.c b/sesman/sig.c index 7405b024..6df57cc1 100644 --- a/sesman/sig.c +++ b/sesman/sig.c @@ -38,6 +38,8 @@ extern tbus g_term_event; void DEFAULT_CC sig_sesman_shutdown(int sig) { + char pid_file[256]; + log_message(&(g_cfg->log), LOG_LEVEL_INFO, "shutting down sesman %d", 1); if (g_getpid() != g_pid) @@ -54,7 +56,8 @@ sig_sesman_shutdown(int sig) session_sigkill_all(); - g_file_delete(SESMAN_PID_FILE); + g_snprintf(pid_file, 255, "%s/xrdp-sesman.pid", XRDP_PID_PATH); + g_file_delete(pid_file); } /******************************************************************************/ diff --git a/sesman/tools/Makefile.am b/sesman/tools/Makefile.am index 81af1554..8282e237 100644 --- a/sesman/tools/Makefile.am +++ b/sesman/tools/Makefile.am @@ -1,3 +1,10 @@ + +AM_CFLAGS = \ + -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ + -DXRDP_SBIN_PATH=\"${sbindir}\" \ + -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ + -DXRDP_PID_PATH=\"${localstatedir}/run\" + INCLUDES = \ -I$(top_srcdir)/common \ -I$(top_srcdir)/sesman/libscp \ |