diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index 6891c2c8105b457d8735d8f4d349b1cfc8576688..dab0e5470cfb7d308b53205f7a2890c64d35fd78 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -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++)