Bugzilla – Bug 421
Does NSD need to change ownership of piddir?
Last modified: 2012-01-06 12:10:28 CET
nsd: failed to unlink pidfile /var/run/nsd/nsd.pid: Permission denied
The daemon creates the pid as root, and "nsdc restart" has no root permission
to replace the pid file.
Because /var/run/nsd is owned by root.
There is already a chown() of the pidfile itself.
If the directory permission does not allow removal, then NSD should not change that. It is not ours (but the packagers' dir).
Can we do truncate("/var/run/nsd/nsd.pid", 0); when the unlink fails? Does an empty pidfile hurt? (does that give errors on restart?)
FTR: I agree, we should not change the ownership of the piddir.
Truncate might just work, as NSD will consider an empty pidfile as no pidfile exists.
Since r3495, in branches/NSD_3_2 we truncate the pidfile instead of unlink it. This way, the piddir does not have to fall under NSD ownership.