]> granicus.if.org Git - postgresql/commitdiff
pg_receivexlog - Exit on failure to parse
authorStephen Frost <sfrost@snowman.net>
Sun, 14 Jul 2013 19:31:23 +0000 (15:31 -0400)
committerStephen Frost <sfrost@snowman.net>
Sun, 14 Jul 2013 19:38:43 +0000 (15:38 -0400)
In streamutil.c:GetConnection(), upgrade failure to parse the
connection string to an exit(1) instead of simply returning NULL.
Most callers already immediately exited, but pg_receivexlog would
loop on this case, continually trying to re-parse the connection
string (which can't be changed after pg_receivexlog has started).

GetConnection() was already expected to exit(1) in some cases
(eg: failure to allocate memory or if unable to determine the
integer_datetimes flag), so this change shouldn't surprise anyone.

Began looking at this due to the Coverity scanner complaining that
we were leaking err_msg in this case- no longer an issue since we
just exit(1) immediately.

src/bin/pg_basebackup/streamutil.c

index 6891c2c8105b457d8735d8f4d349b1cfc8576688..dab0e5470cfb7d308b53205f7a2890c64d35fd78 100644 (file)
@@ -57,7 +57,7 @@ GetConnection(void)
                if (conn_opts == NULL)
                {
                        fprintf(stderr, "%s: %s\n", progname, err_msg);
-                       return NULL;
+                       exit(1);
                }
 
                for (conn_opt = conn_opts; conn_opt->keyword != NULL; conn_opt++)