From: Walter Doekes Date: Thu, 24 Mar 2016 10:38:16 +0000 (+0100) Subject: core/logging: Fix broken syslog levels on older glibc. X-Git-Tag: 11.23.0-rc1~38^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70ca50d96a4f63accaee8e6847ff723d766f2b1a;p=thirdparty%2Fasterisk.git core/logging: Fix broken syslog levels on older glibc. The fix to ASTERISK-25407 introduced the usage of LOG_MAKEPRI. However this macro is broken in older glibc (< 2.17); it would left-shift the facility a second time, causing the resultant priority to become invalid. The syslog manpage mentions nothing about LOG_MAKEPRI and suggests this: The priority argument is formed by ORing the facility and the level values [...]. ASTERISK-25510 #close Reported by: Michael Newton Change-Id: Ia89debe7fac5ad090c7ef595c0707f31bb1e3d03 --- diff --git a/main/logger.c b/main/logger.c index aeb07325d6..5a87d45b43 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1036,7 +1036,8 @@ static void ast_log_vsyslog(struct logmsg *msg, int facility) return; } - syslog_level = LOG_MAKEPRI(facility, syslog_level); + /* Don't use LOG_MAKEPRI because it's broken in glibc<2.17 */ + syslog_level = facility | syslog_level; /* LOG_MAKEPRI(facility, syslog_level); */ snprintf(buf, sizeof(buf), "%s[%d]%s: %s:%d in %s: %s", levels[msg->level], msg->lwp, call_identifier_str, msg->file, msg->line, msg->function, msg->message);