Fix check for -d/--dbname parameter

Not a bug per-se, just meant some unnecessary processing was done on
an empty string.

Per note from petere.
This commit is contained in:
Ian Barwick
2018-05-10 11:57:02 +09:00
parent a880b6ce16
commit 4c49954cd4

View File

@@ -634,7 +634,7 @@ main(int argc, char **argv)
* If -d/--dbname appears to be a conninfo string, validate by attempting * If -d/--dbname appears to be a conninfo string, validate by attempting
* to parse it (and if successful, store the parsed parameters) * to parse it (and if successful, store the parsed parameters)
*/ */
if (runtime_options.dbname) if (runtime_options.dbname[0])
{ {
if (strncmp(runtime_options.dbname, "postgresql://", 13) == 0 || if (strncmp(runtime_options.dbname, "postgresql://", 13) == 0 ||
strncmp(runtime_options.dbname, "postgres://", 11) == 0 || strncmp(runtime_options.dbname, "postgres://", 11) == 0 ||