From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8645 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Bug in macro LOG_MAKEPRI in syslog.h Date: Sun, 11 Oct 2015 22:40:23 -0400 Message-ID: <20151012024023.GN8645@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1444617639 914 80.91.229.3 (12 Oct 2015 02:40:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2015 02:40:39 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8657-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 12 04:40:39 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZlT2U-00066B-L2 for gllmg-musl@m.gmane.org; Mon, 12 Oct 2015 04:40:38 +0200 Original-Received: (qmail 28009 invoked by uid 550); 12 Oct 2015 02:40:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 27989 invoked from network); 12 Oct 2015 02:40:35 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8645 Archived-At: On Tue, Oct 06, 2015 at 09:06:49PM +0200, Pepe Aracil wrote: > Hi all. > > > Now the macro is defined as: > #define LOG_MAKEPRI(f, p) (((f)<<3) | (p)) > And must be: > #define LOG_MAKEPRI(f, p) ((f) | (p)) > > The next example posts wrong facility (LOG_LOCAL1) because LOG_LOCAL1 is > already rotated ( #define LOG_LOCAL1 (17<<3) ). > > syslog (LOG_MAKEPRI(LOG_LOCAL1, LOG_ERROR), > "Unable to make network connection to %s. Error=%m", host); Upon further investigation and discussion, it looks like making this change is the right thing to do. For example: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=729666 I kind of wonder if it would be better to do something like: #define LOG_MAKEPRI(f, p) (((f)&-8) | (p)) in case programs expecting the old definition use the result of LOG_FAC. On the other hand this is all cruft, and LOG_FAC is probably wrong too (anyone have a BSD definition to compare against?) so it might make sense to just start out with a minimal change. Best would be to get programs to stop using these bogus and problematic macros... Rich