summaryrefslogtreecommitdiff
path: root/src/bin/pg_basebackup/streamutil.c
diff options
context:
space:
mode:
authorMagnus Hagander2012-05-27 09:05:24 +0000
committerMagnus Hagander2012-05-27 09:05:24 +0000
commit16282ae688de2b320cf176e9be8a89e4dfc60698 (patch)
treeafcdccdc812a01494100a14638653d4c023980b6 /src/bin/pg_basebackup/streamutil.c
parent2b97db61dd0bffb0843eb2ea9be054d925e88ef1 (diff)
Make pg_recievexlog by default loop on connection failures
Avoids the need for an external script in the most common scenario. Behavior can be overridden using the -n/--noloop commandline parameter.
Diffstat (limited to 'src/bin/pg_basebackup/streamutil.c')
-rw-r--r--src/bin/pg_basebackup/streamutil.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index cc015370ff6..1416faa2e3c 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -65,6 +65,11 @@ xmalloc0(int size)
}
+/*
+ * Connect to the server. Returns a valid PGconn pointer if connected,
+ * or NULL on non-permanent error. On permanent error, the function will
+ * call exit(1) directly.
+ */
PGconn *
GetConnection(void)
{
@@ -151,7 +156,7 @@ GetConnection(void)
{
fprintf(stderr, _("%s: could not connect to server: %s\n"),
progname, PQerrorMessage(tmpconn));
- exit(1);
+ return NULL;
}
/* Connection ok! */