Handle NULL strings when parsing boolean arguments

This commit is contained in:
Ian Barwick
2018-10-17 11:46:29 +09:00
parent 6999dbb52a
commit ab6c3d9b6e
2 changed files with 3 additions and 2 deletions

View File

@@ -1531,6 +1531,9 @@ parse_bool(const char *s, const char *config_item, ItemList *error_list)
{ {
PQExpBufferData errors; PQExpBufferData errors;
if (s == NULL)
return true;
if (strcasecmp(s, "0") == 0) if (strcasecmp(s, "0") == 0)
return false; return false;

View File

@@ -175,7 +175,6 @@ main(int argc, char **argv)
/* daemon options */ /* daemon options */
case 'd': case 'd':
daemonize = true; daemonize = true;
break; break;
@@ -184,7 +183,6 @@ main(int argc, char **argv)
daemonize = parse_bool(optarg, "-d/--daemonize", &cli_errors); daemonize = parse_bool(optarg, "-d/--daemonize", &cli_errors);
break; break;
case 'p': case 'p':
strncpy(pid_file, optarg, MAXPGPATH); strncpy(pid_file, optarg, MAXPGPATH);
break; break;