Update pidfile processing to truncate when writing pid

This commit is contained in:
Paul Kulchenko 2023-10-11 21:36:17 -07:00
parent 6e4b9b6515
commit 07ea10a0b5

View file

@ -7407,7 +7407,7 @@ void RedBean(int argc, char *argv[]) {
Daemonize();
}
if (pidpath) {
fd = open(pidpath, O_CREAT | O_WRONLY, 0644);
fd = open(pidpath, O_CREAT | O_WRONLY | O_TRUNC, 0644);
WRITE(fd, ibuf, FormatInt32(ibuf, getpid()) - ibuf);
close(fd);
}