Now that we're in the critical section, closelog and openlog need to be issued
if the user setting changed, which is something that cannot be done beforehand,
since syslog keeps its file descriptor private.
---
src/util/virlog.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 62533b1..a20cde4 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1605,6 +1605,8 @@ virLogSetOutputs(const char *outputs)
int ret = -1;
int count = 0;
virLogOutputPtr *list = NULL;
+ size_t i;
+ char *tmp = NULL;
if (virLogInitialize() < 0)
return -1;
@@ -1612,6 +1614,17 @@ virLogSetOutputs(const char *outputs)
if ((count = virLogParseOutputs(outputs, &list)) < 0)
goto cleanup;
+ /* syslog needs a special care */
+ for (i = 0; i < count; i++) {
+ if (list[i]->dest == VIR_LOG_TO_SYSLOG) {
+ if (VIR_STRDUP(tmp, list[i]->name) < 0)
+ goto cleanup;
+ VIR_FREE(current_ident);
+ current_ident = tmp;
+ openlog(current_ident, 0, 0);
+ }
+ }
+
if (virLogDefineOutputs(list, count) < 0)
goto cleanup;
--
2.4.3