Skip to content
Snippets Groups Projects
Commit 87c9ab97 authored by Walter Doekes's avatar Walter Doekes Committed by Joshua Colp
Browse files

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
parent d7ee89b4
No related branches found
No related tags found
No related merge requests found
...@@ -1514,7 +1514,8 @@ static void logger_print_normal(struct logmsg *logmsg) ...@@ -1514,7 +1514,8 @@ static void logger_print_normal(struct logmsg *logmsg)
continue; 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)) { if (!chan->formatter.format_log(chan, logmsg, buf, BUFSIZ)) {
syslog(syslog_level, "%s", buf); syslog(syslog_level, "%s", buf);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment