From ad6c703a51c0db4894846409ae0d039c3985302c Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 20 Mar 2017 20:28:49 -0400 Subject: [PATCH] [core] server.syslog-facility (use -1 for unset) (#2800) (thx philipp) x-ref: "lighttpd needs config option for syslog facility" https://redmine.lighttpd.net/issues/2800 --- src/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/log.c b/src/log.c index 640b73fc..528d20ea 100644 --- a/src/log.c +++ b/src/log.c @@ -197,7 +197,7 @@ int open_logfile_or_pipe(server *srv, const char* logfile) { int log_error_open(server *srv) { #ifdef HAVE_SYSLOG_H /* perhaps someone wants to use syslog() */ - int facility = 0; + int facility = -1; if (!buffer_string_is_empty(srv->srvconf.syslog_facility)) { static const struct facility_name_st { const char *name; @@ -253,14 +253,14 @@ int log_error_open(server *srv) { break; } } - if (0 == facility) { + if (-1 == facility) { log_error_write(srv, __FILE__, __LINE__, "SBS", "unrecognized server.syslog-facility: \"", srv->srvconf.syslog_facility, "\"; defaulting to \"daemon\" facility"); } } - openlog("lighttpd", LOG_CONS | LOG_PID, facility ? facility : LOG_DAEMON); + openlog("lighttpd", LOG_CONS | LOG_PID, -1 == facility ? LOG_DAEMON : facility); #endif srv->errorlog_mode = ERRORLOG_FD;