summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 5 insertions, 2 deletions
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"))