]> granicus.if.org Git - pgbouncer/commitdiff
Always check for NULL cf_pidfile
authorMarko Kreen <markokr@gmail.com>
Mon, 22 Feb 2016 08:20:55 +0000 (10:20 +0200)
committerMarko Kreen <markokr@gmail.com>
Tue, 23 Feb 2016 09:02:27 +0000 (11:02 +0200)
It is used before config is loaded.

src/main.c

index 2a09c0bb32d4ca3ed0bcf8a6e7da3dfa7ebe915b..c3c6c97239cae9adb5ec14466284fbf6f81291d5 100644 (file)
@@ -513,7 +513,7 @@ static void go_daemon(void)
 {
        int pid, fd;
 
-       if (!cf_pidfile[0])
+       if (!cf_pidfile || !cf_pidfile[0])
                fatal("daemon needs pidfile configured");
 
        /* don't log to stdout anymore */
@@ -570,7 +570,7 @@ static void check_pidfile(void)
        pid_t pid = 0;
        int fd, res;
 
-       if (!cf_pidfile[0])
+       if (!cf_pidfile || !cf_pidfile[0])
                return;
 
        /* check if pidfile exists */
@@ -616,7 +616,7 @@ static void write_pidfile(void)
        pid_t pid;
        int res, fd;
 
-       if (!cf_pidfile[0])
+       if (!cf_pidfile || !cf_pidfile[0])
                return;
 
        pid = getpid();