From: Andreas Eversberg Date: Sun, 15 Mar 2009 09:19:45 +0000 (+0100) Subject: Check if pid file did not open. X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=commitdiff_plain;h=b2f6c87b1b020e4ac30658422bb144ee3f05a842 Check if pid file did not open. modified: main.c --- diff --git a/main.c b/main.c index 73cfe49..51da4a1 100644 --- a/main.c +++ b/main.c @@ -348,8 +348,11 @@ int main(int argc, char *argv[]) /* write pid file */ pidfile = fopen("/var/run/lcr.pid","w"); - fprintf(pidfile, "%d\n", getpid()); - fclose(pidfile); + if (pidfile) + { + fprintf(pidfile, "%d\n", getpid()); + fclose(pidfile); + } } else /* if not start */ if (!!strcasecmp(argv[1],"start"))