Set the O_CLOEXEC flag when opening the pidfile to avoid leaking the
file descriptor via exec(3). Now that daemon(8) has been fixed to resolve the issue noted by trociny, the consensus is that this change should be OK.
This commit is contained in:
parent
56799b608d
commit
fde4439701
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231938
@ -124,7 +124,7 @@ pidfile_open(const char *path, mode_t mode, pid_t *pidptr)
|
||||
* pidfile_write() can be called multiple times.
|
||||
*/
|
||||
fd = flopen(pfh->pf_path,
|
||||
O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, mode);
|
||||
O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NONBLOCK, mode);
|
||||
if (fd == -1) {
|
||||
if (errno == EWOULDBLOCK && pidptr != NULL) {
|
||||
count = 20;
|
||||
|
Loading…
Reference in New Issue
Block a user