[asterisk-commits] core/logging: Fix broken syslog levels on older glibc. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 25 13:38:39 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: core/logging: Fix broken syslog levels on older glibc.
......................................................................


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
---
M main/logger.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/logger.c b/main/logger.c
index 13f6de8..42a1c70 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -1514,7 +1514,8 @@
 						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);
 					}

-- 
To view, visit https://gerrit.asterisk.org/2453
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia89debe7fac5ad090c7ef595c0707f31bb1e3d03
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Walter Doekes <walter+asterisk at wjd.nu>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-commits mailing list