From: Walter Doekes Date: Thu, 24 Mar 2016 10:48:32 +0000 (+0100) Subject: core/logging: Fix broken syslog levels on older glibc. X-Git-Tag: 14.0.0-beta1~314^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87c9ab97ea8038b3ef694d027bce26f29ea24777;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 13f6de8902..42a1c70004 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1514,7 +1514,8 @@ static void logger_print_normal(struct logmsg *logmsg) continue; } - syslog_level = LOG_MAKEPRI(chan->facility, syslog_level); + /* Don't use LOG_MAKEPRI because it's broken in glibc<2.17 */ + syslog_level = chan->facility | syslog_level; /* LOG_MAKEPRI(chan->facility, syslog_level); */ if (!chan->formatter.format_log(chan, logmsg, buf, BUFSIZ)) { syslog(syslog_level, "%s", buf); }