Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Apr 2007 14:16:34 +0200
From:      Stefan Ehmann <shoesoft@gmx.net>
To:        freebsd-questions@freebsd.org
Subject:   syslog(3) as user sets errno
Message-ID:  <200704281416.34783.shoesoft@gmx.net>

next in thread | raw e-mail | index | archive | help
If a non-privilged program calls syslog(3), after the call, errno is set to 13 
(permission denied).

In lib/libc/gen/syslog.c connectlog(), it is first tried to connect 
to /var/run/logpriv. If it fails /var/run/log is tried.

The first connect fails if syslog() is not called as root, it fails with 
errno=13 and the second connect succeeds.

This is all fine, except that errno is set to 13 after calling syslog().

Is this a bug or expected behaviour?

IMHO errno should be set to 0 before the second connect is called -- or is 
this a bad idea?

Stefan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704281416.34783.shoesoft>