This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix LOG_MAKEPRI to agree with BSD


This bug has been fixed in BSD 15 years ago.  A google search could only
find BSD-style uses of LOG_MAKEPRI.  There was a posting related to this
bug in de.comp.lang.c about a year ago, but it received no followups.
It looks like uses of LOG_MAKEPRI outside of BSD are extremly rare, if
not non-existing.

Andreas.

	[BZ #14347]
	* misc/sys/syslog.h (LOG_MAKEPRI): Don't shift first argument.
	(INTERNAL_MARK): Shift it here.

diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index 77123ab..41331a8 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -60,12 +60,12 @@
 #define	LOG_PRIMASK	0x07	/* mask to extract priority part (internal) */
 				/* extract priority */
 #define	LOG_PRI(p)	((p) & LOG_PRIMASK)
-#define	LOG_MAKEPRI(fac, pri)	(((fac) << 3) | (pri))
+#define	LOG_MAKEPRI(fac, pri)	((fac) | (pri))
 
 #ifdef SYSLOG_NAMES
 #define	INTERNAL_NOPRI	0x10	/* the "no priority" priority */
 				/* mark "facility" */
-#define	INTERNAL_MARK	LOG_MAKEPRI(LOG_NFACILITIES, 0)
+#define	INTERNAL_MARK	LOG_MAKEPRI(LOG_NFACILITIES << 3, 0)
 typedef struct _code {
 	char	*c_name;
 	int	c_val;
-- 
1.7.11.1

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]