From 071356e5d6876318b0f321494fe9c90b1c52b329 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Sun, 28 Sep 2003 02:38:18 +0000 Subject: [PATCH] Whoops, looks like O_TRUNC was missing when opening the file, increasing the chance of left-overs from older pid contents in the file. --- pidfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidfile.c b/pidfile.c index 0852029..e0959a0 100644 --- a/pidfile.c +++ b/pidfile.c @@ -87,7 +87,7 @@ int write_pid (char *pidfile) int fd; 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) ) { fprintf(stderr, "Can't open or create %s.\n", pidfile); return 0;