summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'log.c')
-rw-r--r--log.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/log.c b/log.c
index 3f87a63ee..bab88feea 100644
--- a/log.c
+++ b/log.c
@@ -194,6 +194,9 @@ debug3(const char *fmt,...)
194void 194void
195log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) 195log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
196{ 196{
197#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
198 struct syslog_data sdata = SYSLOG_DATA_INIT;
199#endif
197 argv0 = av0; 200 argv0 = av0;
198 201
199 switch (level) { 202 switch (level) {
@@ -263,6 +266,19 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
263 (int) facility); 266 (int) facility);
264 exit(1); 267 exit(1);
265 } 268 }
269
270 /*
271 * If an external library (eg libwrap) attempts to use syslog
272 * immediately after reexec, syslog may be pointing to the wrong
273 * facility, so we force an open/close of syslog here.
274 */
275#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
276 openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
277 closelog_r(&sdata);
278#else
279 openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
280 closelog();
281#endif
266} 282}
267 283
268#define MSGBUFSIZ 1024 284#define MSGBUFSIZ 1024