summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Makefile.am3
-rw-r--r--common/log.c17
2 files changed, 18 insertions, 2 deletions
diff --git a/common/Makefile.am b/common/Makefile.am
index 1bc5eeb6..33cfc1e5 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -5,7 +5,8 @@ AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
- -DXRDP_PID_PATH=\"${localstatedir}/run\"
+ -DXRDP_PID_PATH=\"${localstatedir}/run\" \
+ -DXRDP_LOG_PATH=\"${localstatedir}/log\"
lib_LTLIBRARIES = \
libcommon.la
diff --git a/common/log.c b/common/log.c
index cdf250ea..390b2bff 100644
--- a/common/log.c
+++ b/common/log.c
@@ -313,6 +313,7 @@ internal_config_read_logging(int file, struct log_config* lc,
{
int i;
char* buf;
+ char* temp_buf;
list_clear(param_v);
list_clear(param_n);
@@ -332,6 +333,16 @@ internal_config_read_logging(int file, struct log_config* lc,
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_FILE))
{
lc->log_file = g_strdup((char*)list_get_item(param_v, i));
+ if (lc->log_file != NULL)
+ {
+ if (lc->log_file[0] != '/')
+ {
+ temp_buf = (char*)g_malloc(512, 0);
+ g_snprintf(temp_buf, 511, "%s/%s", XRDP_LOG_PATH, lc->log_file);
+ g_free(lc->log_file);
+ lc->log_file = temp_buf;
+ }
+ }
}
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_LEVEL))
{
@@ -352,6 +363,9 @@ internal_config_read_logging(int file, struct log_config* lc,
lc->log_file = g_strdup("./sesman.log");
}
+ /* try to create path if not exist */
+ g_create_path(lc->log_file);
+
g_printf("logging configuration:\r\n");
g_printf("\tLogFile: %s\r\n", lc->log_file);
g_printf("\tLogLevel: %i\r\n", lc->log_level);
@@ -423,7 +437,8 @@ log_start_from_param(const struct log_config* iniParams)
ret = internalInitAndAllocStruct();
if (ret != LOG_STARTUP_OK)
{
- return ret;
+ g_writeln("internalInitAndAllocStruct failed");
+ return ret;
}
staticLogConfig->enable_syslog = iniParams->enable_syslog;
staticLogConfig->fd = iniParams->fd;