From ab6c3d9b6e7d65b2934d0e94bcef9c93f0380010 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 17 Oct 2018 11:46:29 +0900 Subject: [PATCH] Handle NULL strings when parsing boolean arguments --- configfile.c | 3 +++ repmgrd.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configfile.c b/configfile.c index 22ceabd2..35c3924d 100644 --- a/configfile.c +++ b/configfile.c @@ -1531,6 +1531,9 @@ parse_bool(const char *s, const char *config_item, ItemList *error_list) { PQExpBufferData errors; + if (s == NULL) + return true; + if (strcasecmp(s, "0") == 0) return false; diff --git a/repmgrd.c b/repmgrd.c index 311a8b5a..4e4776e9 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -175,7 +175,6 @@ main(int argc, char **argv) /* daemon options */ - case 'd': daemonize = true; break; @@ -184,7 +183,6 @@ main(int argc, char **argv) daemonize = parse_bool(optarg, "-d/--daemonize", &cli_errors); break; - case 'p': strncpy(pid_file, optarg, MAXPGPATH); break;