Patch from tilman2: Open PID file with O_EXCL
[umurmur.git] / src / main.c
index 863a7d4dacfd2ca8e54b35bd3414ef12c7e092ab..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);
@@ -130,7 +130,7 @@ void printhelp()
 {
        printf("uMurmur version %s. Mumble protocol %d.%d.%d\n", UMURMUR_VERSION, PROTVER_MAJOR, PROTVER_MINOR, PROTVER_PATCH);
        printf("Usage: umurmurd [-d] [-p <pidfile>] [-c <conf file>] [-h]\n");
-       printf("       -d             - Do not deamonize\n");
+       printf("       -d             - Do not daemonize\n");
        printf("       -p <pidfile>   - Write PID to this file\n");
        printf("       -c <conf file> - Specify configuration file\n");
 #ifdef _POSIX_PRIORITY_SCHEDULING