summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2005-05-25 11:01:01 +0000
committerColin Watson <cjwatson@debian.org>2005-05-25 11:01:01 +0000
commite88de75a1a236779a10e8ccbcc51d25308be8840 (patch)
tree7495477a2a7d0cac17a9fcded020b6ea816182ef /log.c
parent30a0f9443782cd9d7308acd09430bf586186aa55 (diff)
parent5d05471f6657646d1d6500c7c43134462c407ee6 (diff)
Merge 4.0p1 to the trunk.
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