Subject: lib/951: Syslog and vsyslog do not honor log mask from setlogmask
To: None <gnats-admin@NetBSD.ORG>
From: Ted Lemon <mellon@fugue.com>
List: netbsd-bugs
Date: 04/10/1995 18:05:09
>Number: 951
>Category: lib
>Synopsis: Syslog and vsyslog do not honor log mask from setlogmask
>Confidential: no
>Severity: non-critical
>Priority: high
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 10 18:05:06 1995
>Originator: Ted Lemon
>Organization:
Chukkung Ri Avalance Works
>Release: April 9, 1995
>Environment:
System: NetBSD toccata 1.0A NetBSD 1.0A (TOCCATA) #55: Sun Apr 9 23:32:09 PDT 1995 mellon@toccata:/sandbox/NetBSD-current/sys/arch/pmax/compile/TOCCATA pmax
>Description:
I have syslog(LOG_DEBUG, ...) statements sprinkled throughout
my code. In order to prevent these from polluting the log when
I'm not debugging, I have a setlogmask(LOG_UPTO(LOG_INFO))
call in my program right after openlog(). Unfortunately, on
BSD/OS, this has no effect.
>How-To-Repeat:
See above.
>Fix:
It's an operator precedence bug. The fix is an extra pair of
parentheses:
*** /usr/src/lib/libc/gen/syslog.c Thu Feb 2 22:24:25 1995
--- syslog.c Mon Apr 10 17:10:26 1995
***************
*** 110,114 ****
/* Check priority against setlogmask values. */
! if (!LOG_MASK(LOG_PRI(pri)) & LogMask)
return;
--- 110,114 ----
/* Check priority against setlogmask values. */
! if (!(LOG_MASK(LOG_PRI(pri)) & LogMask))
return;
>Audit-Trail:
>Unformatted: