diff options
author | ghelmer <ghelmer@FreeBSD.org> | 2012-01-05 22:48:36 +0000 |
---|---|---|
committer | ghelmer <ghelmer@FreeBSD.org> | 2012-01-05 22:48:36 +0000 |
commit | cb04d194f43ed42f8c7a481a92e85c086db45df9 (patch) | |
tree | 653e0ec5d386da5e9d9755005f3c3efb3229a3f6 /usr.sbin/daemon | |
parent | dc84417a34ae4a2b2c415dc2e403163535c8589d (diff) | |
download | FreeBSD-src-cb04d194f43ed42f8c7a481a92e85c086db45df9.zip FreeBSD-src-cb04d194f43ed42f8c7a481a92e85c086db45df9.tar.gz |
Allow daemon(8) to run pidfile_open() before relenquishing privileges
so pid files can be written in /var/run when started as root.
I do not expect this to cause any security issues, but if anyone objects
it could be easily reverted.
PR: bin/159568
MFC after: 4 weeks
Diffstat (limited to 'usr.sbin/daemon')
-rw-r--r-- | usr.sbin/daemon/daemon.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 540ebf3..8b25800 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -79,9 +79,6 @@ 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 @@ -97,6 +94,9 @@ main(int argc, char *argv[]) } } + if (user != NULL) + restrict_process(user); + if (daemon(nochdir, noclose) == -1) err(1, NULL); |