summaryrefslogtreecommitdiff
path: root/sysdep/unix/log.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-08 19:27:58 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-08 19:27:58 +0100
commit8860e991f6650e47cfe6c1af595fe4fe92a4edfd (patch)
tree18f49bb3a21739a1a596b54d9f65e82cff4fc09f /sysdep/unix/log.c
parentcc5b93f72db80abd1262a0a5e1d8400ceef54385 (diff)
parentc8cafc8ebb5320ac7c6117c17e6460036f0fdf62 (diff)
Merge branch 'master' into int-new
Diffstat (limited to 'sysdep/unix/log.c')
-rw-r--r--sysdep/unix/log.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c
index e5c5e74e..42c933ef 100644
--- a/sysdep/unix/log.c
+++ b/sysdep/unix/log.c
@@ -288,18 +288,22 @@ log_switch(int debug, list *l, char *new_syslog_name)
current_log_list = l;
#ifdef HAVE_SYSLOG
- char *old_syslog_name = current_syslog_name;
- current_syslog_name = new_syslog_name;
-
- if (old_syslog_name && new_syslog_name &&
- !strcmp(old_syslog_name, new_syslog_name))
+ if (current_syslog_name && new_syslog_name &&
+ !strcmp(current_syslog_name, new_syslog_name))
return;
- if (old_syslog_name)
+ if (current_syslog_name)
+ {
closelog();
+ xfree(current_syslog_name);
+ current_syslog_name = NULL;
+ }
if (new_syslog_name)
- openlog(new_syslog_name, LOG_CONS | LOG_NDELAY, LOG_DAEMON);
+ {
+ current_syslog_name = xstrdup(new_syslog_name);
+ openlog(current_syslog_name, LOG_CONS | LOG_NDELAY, LOG_DAEMON);
+ }
#endif
}