diff options
author | Walter Doekes <walter+asterisk@wjd.nu> | 2016-03-24 11:38:16 +0100 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-03-24 06:34:20 -0500 |
commit | 82e55e48835b3f71aa88c439ab406266b494d4f8 (patch) | |
tree | 16fa64e2470d0031ee17eb44b4080c73466bc807 | |
parent | c5170677e72e48b487462e79a31974845a417dce (diff) |
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
-rw-r--r-- | main/logger.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/main/logger.c b/main/logger.c index 46d9cbb57..9db33c954 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1322,7 +1322,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); |