From: Eric Bollengier Date: Mon, 8 Jun 2020 11:29:31 +0000 (+0200) Subject: Fix org#2484 Use message type to determine syslog message level X-Git-Tag: Release-9.6.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4975935f39b86122b083d415c5d17c443e8c43ab;p=thirdparty%2Fbacula.git Fix org#2484 Use message type to determine syslog message level --- diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index f643a240c..ddc788f0b 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -787,6 +787,22 @@ static void send_to_syslog(int mode, const char *msg) const char *p2; const char *p = msg; + switch (mode) { + case M_ERROR_TERM: + case M_ABORT: + mode = LOG_DAEMON|LOG_ERR; + break; + case M_FATAL: + case M_ERROR: + case M_WARNING: + case M_SECURITY: + mode = LOG_DAEMON|LOG_NOTICE; + break; + default: + mode = LOG_DAEMON|LOG_INFO; + break; + } + while (*p && ((p2 = strchr(p, '\n')) != NULL)) { len = MIN((int)sizeof(buf) - 1, p2 - p + 1); /* Add 1 to keep \n */ bstrncpy(buf, p, len); @@ -948,7 +964,7 @@ void dispatch_message(JCR *jcr, int type, utime_t mtime, char *msg) /* * We really should do an openlog() here. */ - send_to_syslog(LOG_DAEMON|LOG_ERR, msg); + send_to_syslog(type, msg); break; case MD_OPERATOR: Dmsg1(850, "OPERATOR for following msg: %s\n", msg);