diff --git a/ChangeLog b/ChangeLog index e06821fa1559d5b23bbd30570d71214ecb02dec5..4eb0955e878daaaba02050cbd2fc5dd6affee995 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jan 20 22:32:44 CET 2009 Daniel Veillard + + * src/logging.c: fix openlog() ident lifetime for Solaris + Tue Jan 20 21:02:53 GMT 2009 Daniel P. Berrange Refresh GNULIB, adding new random_r module diff --git a/src/logging.c b/src/logging.c index d6bd22aa8b915e8367e65432f87a8b98a80671e1..9c8b0b95dcf21af82cd80b57a84a9aec5798c150 100644 --- a/src/logging.c +++ b/src/logging.c @@ -626,15 +626,27 @@ static int virLogOutputToSyslog(const char *category ATTRIBUTE_UNUSED, return(len); } +static char *current_ident = NULL; + static void virLogCloseSyslog(void *data ATTRIBUTE_UNUSED) { closelog(); + VIR_FREE(current_ident); } static int virLogAddOutputToSyslog(int priority, const char *ident) { - openlog(ident, 0, 0); + /* + * ident needs to be kept around on Solaris + */ + VIR_FREE(current_ident); + current_ident = strdup(ident); + if (current_ident == NULL) + return(-1); + + openlog(current_ident, 0, 0); if (virLogDefineOutput(virLogOutputToSyslog, virLogCloseSyslog, NULL, priority, 0) < 0) { closelog(); + VIR_FREE(current_ident); return(-1); } return(0);