summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>2012-01-25 14:50:12 +0000
committerghelmer <ghelmer@FreeBSD.org>2012-01-25 14:50:12 +0000
commit203029c5bfebcaa570e737934e67a8d964ad6cb0 (patch)
tree5a831aaf858eadb8ba35938b3d8a6558ba4588b4 /usr.sbin
parentdbd94fb4b8925880c1e2cefc7dfd8d653c627fa3 (diff)
downloadFreeBSD-src-203029c5bfebcaa570e737934e67a8d964ad6cb0.zip
FreeBSD-src-203029c5bfebcaa570e737934e67a8d964ad6cb0.tar.gz
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/daemon/daemon.84
-rw-r--r--usr.sbin/daemon/daemon.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/daemon/daemon.8 b/usr.sbin/daemon/daemon.8
index bdebd83..7dde24b 100644
--- a/usr.sbin/daemon/daemon.8
+++ b/usr.sbin/daemon/daemon.8
@@ -59,6 +59,10 @@ Write the ID of the created process into the
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).
diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c
index 8b25800..540ebf3 100644
--- a/usr.sbin/daemon/daemon.c
+++ b/usr.sbin/daemon/daemon.c
@@ -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);
OpenPOWER on IntegriCloud