Patch from tilman2: Open PID file with O_EXCL
authorfatbob313 <martin@fatbob.nu>
Thu, 20 Jan 2011 08:24:21 +0000 (08:24 +0000)
committerfatbob313 <martin@fatbob.nu>
Thu, 20 Jan 2011 08:24:21 +0000 (08:24 +0000)
src/main.c

index 70358e61ad88ebb71215f4f3041760e546044515..1b92f50797e931a0807de2ed5f91548844ec9304 100644 (file)
@@ -60,7 +60,7 @@ void lockfile(const char *pidfile)
        int lfp;
        char str[16];
        
-       lfp = open(pidfile, O_RDWR|O_CREAT, 0640);
+       lfp = open(pidfile, O_RDWR|O_CREAT|O_EXCL, 0640);
        
        if (lfp < 0)
                Log_fatal("Cannot open PID-file %s for writing", pidfile);