Whoops, looks like O_TRUNC was missing when opening the file,
increasing the chance of left-overs from older pid contents in the file.
This commit is contained in:
parent
0f9873bed4
commit
071356e5d6
@ -87,7 +87,7 @@ int write_pid (char *pidfile)
|
|||||||
int fd;
|
int fd;
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
|
if ( ((fd = open(pidfile, O_RDWR|O_CREAT|O_TRUNC, 0644)) == -1)
|
||||||
|| ((f = fdopen(fd, "r+")) == NULL) ) {
|
|| ((f = fdopen(fd, "r+")) == NULL) ) {
|
||||||
fprintf(stderr, "Can't open or create %s.\n", pidfile);
|
fprintf(stderr, "Can't open or create %s.\n", pidfile);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user