]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Don't allow both --source-server and --source-target args to pg_rewind.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 7 Oct 2016 11:35:17 +0000 (14:35 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 7 Oct 2016 11:35:45 +0000 (14:35 +0300)
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

index 9f2f08ebc4146cd1fcbb3b455f05df7a51e0446f..cc0568064f98a8b4adc94a403661c5f25f3c7180 100644 (file)
@@ -158,6 +158,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);