From 2933ed0362ae5fbc9e0c28035286318b4d299492 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 7 Oct 2016 14:35:17 +0300 Subject: [PATCH] Don't allow both --source-server and --source-target args to pg_rewind. They are supposed to be mutually exclusive, but there was no check for that. Michael Banck Discussion: <20161007103414.GD12247@nighthawk.caipicrew.dd-dns.de> --- src/bin/pg_rewind/pg_rewind.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index 5fdd4c5605..dd62dd0549 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -162,6 +162,13 @@ main(int argc, char **argv) exit(1); } + if (datadir_source != NULL && connstr_source != NULL) + { + fprintf(stderr, _("%s: only one of --source-pgdata or --source-server can be specified\n"), progname); + fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); + exit(1); + } + if (datadir_target == NULL) { fprintf(stderr, _("%s: no target data directory specified (--target-pgdata)\n"), progname); -- 2.40.0