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
This commit is contained in:
parent
1e96ae8193
commit
074db536b3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=229667
@ -79,9 +79,6 @@ 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
|
||||||
@ -97,6 +94,9 @@ 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