From owner-svn-src-head@FreeBSD.ORG Wed Jan 25 14:50:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00FD71065679; Wed, 25 Jan 2012 14:50:13 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3A7F8FC12; Wed, 25 Jan 2012 14:50:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0PEoCZs029246; Wed, 25 Jan 2012 14:50:12 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0PEoCe8029243; Wed, 25 Jan 2012 14:50:12 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201251450.q0PEoCe8029243@svn.freebsd.org> From: Guy Helmer Date: Wed, 25 Jan 2012 14:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230541 - head/usr.sbin/daemon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 14:50:13 -0000 Author: ghelmer Date: Wed Jan 25 14:50:12 2012 New Revision: 230541 URL: http://svn.freebsd.org/changeset/base/230541 Log: Revert 229667: After some discussion of this change, it seems it is better to leave the pidfile open where it was. Add a note to the man page describing pidfile strategies to use if the daemon is to be run as a user other than root. Modified: head/usr.sbin/daemon/daemon.8 head/usr.sbin/daemon/daemon.c Modified: head/usr.sbin/daemon/daemon.8 ============================================================================== --- head/usr.sbin/daemon/daemon.8 Wed Jan 25 14:38:00 2012 (r230540) +++ head/usr.sbin/daemon/daemon.8 Wed Jan 25 14:50:12 2012 (r230541) @@ -59,6 +59,10 @@ Write the ID of the created process into using the .Xr pidfile 3 functionality. +If the +.Fl u +option is used, the directory to contain the pidfile must be writable +by the specified user. Note, that the file will be created shortly before the process is actually executed, and will remain after the process exits (although it will be removed if the execution fails). Modified: head/usr.sbin/daemon/daemon.c ============================================================================== --- head/usr.sbin/daemon/daemon.c Wed Jan 25 14:38:00 2012 (r230540) +++ head/usr.sbin/daemon/daemon.c Wed Jan 25 14:50:12 2012 (r230541) @@ -79,6 +79,9 @@ main(int argc, char *argv[]) if (argc == 0) usage(); + if (user != NULL) + restrict_process(user); + /* * Try to open the pidfile before calling daemon(3), * to be able to report the error intelligently @@ -94,9 +97,6 @@ main(int argc, char *argv[]) } } - if (user != NULL) - restrict_process(user); - if (daemon(nochdir, noclose) == -1) err(1, NULL);