X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain.c;h=8a0573ab41eaccdd7e2cb3345bbf0b2a85f3520a;hb=3fbab274e9932e10d257e70fad310e00a4260d43;hp=8c5febd6fb742b291c3d7e1e32ea9ac816ae1dc4;hpb=1c9b1f27ae2c73853f1c493885315506923a04be;p=umurmur.git diff --git a/src/main.c b/src/main.c index 8c5febd..8a0573a 100644 --- a/src/main.c +++ b/src/main.c @@ -60,12 +60,13 @@ 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); - sprintf(str,"%d\n", getpid()); + snprintf(str,16,"%d\n", getpid()); write(lfp, str, strlen(str)); /* record pid to lockfile */ + close(lfp); Log_info("PID-file: %s", pidfile); } @@ -130,7 +131,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 ] [-c ] [-h]\n"); - printf(" -d - Do not deamonize\n"); + printf(" -d - Do not daemonize\n"); printf(" -p - Write PID to this file\n"); printf(" -c - Specify configuration file\n"); #ifdef _POSIX_PRIORITY_SCHEDULING