summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2010-07-26 03:46:36 +0000
committerjsorg71 <jsorg71>2010-07-26 03:46:36 +0000
commitfb7e652d657c77ec61fc7924328bd2ec2768bbcd (patch)
treeb341e96a541fd56ee4152f0403ca5e3515de626b /sesman
parentf6f005ca58b8ca6986a9661c9bc89479d7743cf9 (diff)
downloadxrdp-proprietary-fb7e652d657c77ec61fc7924328bd2ec2768bbcd.tar.gz
xrdp-proprietary-fb7e652d657c77ec61fc7924328bd2ec2768bbcd.zip
Fix sesman logging disruption after SIGHUP
Diffstat (limited to 'sesman')
-rw-r--r--sesman/sig.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sesman/sig.c b/sesman/sig.c
index acea2429..2336815c 100644
--- a/sesman/sig.c
+++ b/sesman/sig.c
@@ -64,6 +64,7 @@ sig_sesman_shutdown(int sig)
void DEFAULT_CC
sig_sesman_reload_cfg(int sig)
{
+ int error;
struct config_sesman *cfg;
log_message(&(g_cfg->log), LOG_LEVEL_WARNING, "receiving SIGHUP %d", 1);
@@ -86,10 +87,30 @@ sig_sesman_reload_cfg(int sig)
log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "error reading config - keeping old cfg");
return;
}
-#warning FIXME reload configuration must NOT damage logging!
+
+ /* stop logging subsystem */
+ log_end(&(g_cfg->log));
+
+ /* replace old config with new readed one */
g_cfg = cfg;
- log_message(&(g_cfg->log), LOG_LEVEL_INFO, "configuration reloaded");
+ /* start again logging subsystem */
+ error = log_start(&(g_cfg->log));
+
+ if (error != LOG_STARTUP_OK)
+ {
+ switch (error)
+ {
+ case LOG_ERROR_MALLOC:
+ g_printf("error on malloc. cannot restart logging. log stops here, sorry.\n");
+ break;
+ case LOG_ERROR_FILE_OPEN:
+ g_printf("error reopening log file [%s]. log stops here, sorry.\n", g_cfg->log.log_file);
+ break;
+ }
+ }
+
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO, "configuration reloaded, log subsystem restarted");
}
/******************************************************************************/