mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +00:00
* src/logging.c: fix openlog() ident lifetime for Solaris
daniel
This commit is contained in:
parent
89408fd3a0
commit
5fb1e29c7e
@ -1,3 +1,7 @@
|
|||||||
|
Tue Jan 20 22:32:44 CET 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/logging.c: fix openlog() ident lifetime for Solaris
|
||||||
|
|
||||||
Tue Jan 20 21:02:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
Tue Jan 20 21:02:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
Refresh GNULIB, adding new random_r module
|
Refresh GNULIB, adding new random_r module
|
||||||
|
@ -626,15 +626,27 @@ static int virLogOutputToSyslog(const char *category ATTRIBUTE_UNUSED,
|
|||||||
return(len);
|
return(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *current_ident = NULL;
|
||||||
|
|
||||||
static void virLogCloseSyslog(void *data ATTRIBUTE_UNUSED) {
|
static void virLogCloseSyslog(void *data ATTRIBUTE_UNUSED) {
|
||||||
closelog();
|
closelog();
|
||||||
|
VIR_FREE(current_ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virLogAddOutputToSyslog(int priority, const char *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,
|
if (virLogDefineOutput(virLogOutputToSyslog, virLogCloseSyslog, NULL,
|
||||||
priority, 0) < 0) {
|
priority, 0) < 0) {
|
||||||
closelog();
|
closelog();
|
||||||
|
VIR_FREE(current_ident);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user