Truncate PID file after opening and locking
This commit is contained in:
parent
00e35a1031
commit
620735523f
3
daemon.c
3
daemon.c
@ -251,6 +251,9 @@ int main(int argc, char *argv[]) {
|
||||
pidPath, O_WRONLY | O_CREAT | O_EXLOCK | O_CLOEXEC, 0600
|
||||
);
|
||||
if (pidFile < 0) err(EX_CANTCREAT, "%s", pidPath);
|
||||
|
||||
error = ftruncate(pidFile, 0);
|
||||
if (error) err(EX_IOERR, "%s", pidPath);
|
||||
}
|
||||
|
||||
// We can't lock a named pipe, so just warn if it already exists.
|
||||
|
Loading…
Reference in New Issue
Block a user