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.
This commit is contained in:
parent
5be9d54a2b
commit
704523b073
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230541
@ -59,6 +59,10 @@ Write the ID of the created process into the
|
|||||||
using the
|
using the
|
||||||
.Xr pidfile 3
|
.Xr pidfile 3
|
||||||
functionality.
|
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
|
Note, that the file will be created shortly before the process is
|
||||||
actually executed, and will remain after the process exits (although
|
actually executed, and will remain after the process exits (although
|
||||||
it will be removed if the execution fails).
|
it will be removed if the execution fails).
|
||||||
|
@ -79,6 +79,9 @@ main(int argc, char *argv[])
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
if (user != NULL)
|
||||||
|
restrict_process(user);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to open the pidfile before calling daemon(3),
|
* Try to open the pidfile before calling daemon(3),
|
||||||
* to be able to report the error intelligently
|
* 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)
|
if (daemon(nochdir, noclose) == -1)
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user