- (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some
platforms syslog will revert to its default values. This may result in messages from external libraries (eg libwrap) being sent to a different facility.
This commit is contained in:
parent
218f178cb2
commit
9b5495d23e
|
@ -1,3 +1,9 @@
|
|||
20050201
|
||||
- (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some
|
||||
platforms syslog will revert to its default values. This may result in
|
||||
messages from external libraries (eg libwrap) being sent to a different
|
||||
facility.
|
||||
|
||||
20050124
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
- otto@cvs.openbsd.org 2005/01/21 08:32:02
|
||||
|
@ -2043,4 +2049,4 @@
|
|||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||
|
||||
$Id: ChangeLog,v 1.3626 2005/01/24 11:50:47 dtucker Exp $
|
||||
$Id: ChangeLog,v 1.3627 2005/02/01 06:35:09 dtucker Exp $
|
||||
|
|
16
log.c
16
log.c
|
@ -194,6 +194,9 @@ void
|
|||
log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
|
||||
{
|
||||
argv0 = av0;
|
||||
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
|
||||
struct syslog_data sdata = SYSLOG_DATA_INIT;
|
||||
#endif
|
||||
|
||||
switch (level) {
|
||||
case SYSLOG_LEVEL_QUIET:
|
||||
|
@ -261,6 +264,19 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
|
|||
(int) facility);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* If an external library (eg libwrap) attempts to use syslog
|
||||
* immediately after reexec, syslog may be pointing to the wrong
|
||||
* facility, so we force an open/close of syslog here.
|
||||
*/
|
||||
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
|
||||
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
|
||||
closelog_r(&sdata);
|
||||
#else
|
||||
openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
|
||||
closelog();
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MSGBUFSIZ 1024
|
||||
|
|
Loading…
Reference in New Issue