Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.kei.com!newsfeed.internetmci.com!howland.reston.ans.net!blackbush.xlink.net!wega.fibronics.de!lif.de!layla.RoBIN.de!marvin.RoBIN.de!marvin.RoBIN.de!not-for-mail
From: andreas@marvin.RoBIN.de (Andreas Lohr)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: syslog(3) in 2.0-RELEASE
Date: 25 Nov 1995 19:52:03 +0100
Organization: disorganized
Lines: 39
Message-ID: <497okj$453@marvin.RoBIN.de>
NNTP-Posting-Host: marvin.robin.de
X-Newsreader: TIN [version 1.2 PL2]
Consider the following code:
#include <syslog.h>
int main(void)
{
openlog("foo", LOG_PERROR, LOG_USER);
setlogmask(LOG_UPTO(LOG_INFO));
syslog(LOG_INFO, "info");
syslog(LOG_DEBUG, "debug");
return 0;
}
The stderr output is
foo: info
foo: debug
The output I have expected is
foo: info
because I have set the logmask to exclude debugging messages. The
function vsyslog() uses the folling if-statement:
....
/* Check priority against setlogmask values. */
if (!LOG_MASK(LOG_PRI(pri)) & LogMask)
return;
....
Shouldn't this be changed to
if (!(LOG_MASK(LOG_PRI(pri)) & LogMask))
return;
Or has this already been done?
Andreas
--
andreas@marvin.robin.de "Beware of programmers carrying screwdrivers!"