From owner-freebsd-questions@FreeBSD.ORG Sat Apr 28 12:43:17 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C30016A401 for ; Sat, 28 Apr 2007 12:43:17 +0000 (UTC) (envelope-from shoesoft@gmx.net) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id DA7C713C45B for ; Sat, 28 Apr 2007 12:43:16 +0000 (UTC) (envelope-from shoesoft@gmx.net) Received: (qmail invoked by alias); 28 Apr 2007 12:16:35 -0000 Received: from h081217094222.dyn.cm.kabsi.at (EHLO taxman.pepperland) [81.217.94.222] by mail.gmx.net (mp037) with SMTP; 28 Apr 2007 14:16:35 +0200 X-Authenticated: #16703784 X-Provags-ID: V01U2FsdGVkX1/BYHp+nqvBSPfsntxRqPSfqC9oTha3zh4cDZ0Ssi +FsjnMGYzUtrrI From: Stefan Ehmann To: freebsd-questions@freebsd.org Date: Sat, 28 Apr 2007 14:16:34 +0200 User-Agent: KMail/1.9.6 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200704281416.34783.shoesoft@gmx.net> X-Y-GMX-Trusted: 0 Subject: syslog(3) as user sets errno X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2007 12:43:17 -0000 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