From: Marko Kreen Date: Mon, 22 Feb 2016 08:20:55 +0000 (+0200) Subject: Always check for NULL cf_pidfile X-Git-Tag: pgbouncer_1_7_2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07df4a5d9c034e82d07fe720262cad6109f33edb;p=pgbouncer Always check for NULL cf_pidfile It is used before config is loaded. --- diff --git a/src/main.c b/src/main.c index 2a09c0b..c3c6c97 100644 --- a/src/main.c +++ b/src/main.c @@ -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();