1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-24 11:46:31 +02:00

Fix handling of unrecognized options

This commit is contained in:
Artur Zakirov 2017-02-15 16:22:49 +03:00
parent b8640a72b8
commit b188a8a5e3
2 changed files with 3 additions and 2 deletions

View File

@ -75,7 +75,7 @@ static pgut_option options[] =
{ 's', 5, "inclusive", &target_inclusive, SOURCE_CMDLINE },
{ 'u', 6, "timeline", &target_tli, SOURCE_CMDLINE },
/* delete options */
{ 'b', 12, "wal", &delete_wal },
{ 'b', 12, "wal", &delete_wal, SOURCE_CMDLINE },
/* retention options */
{ 'u', 13, "redundancy", &retention_redundancy, SOURCE_CMDLINE },
{ 'u', 14, "window", &retention_window, SOURCE_CMDLINE },

View File

@ -631,9 +631,10 @@ pgut_getopt(int argc, char **argv, pgut_option options[])
while ((c = getopt_long(argc, argv, optstring, longopts, &optindex)) != -1)
{
opt = option_find(c, default_options, options);
if (opt->allowed < SOURCE_CMDLINE)
if (opt && opt->allowed < SOURCE_CMDLINE)
elog(ERROR, "option %s cannot be specified in command line",
opt->lname);
/* Check 'opt == NULL' is performed in assign_option() */
assign_option(opt, optarg, SOURCE_CMDLINE);
}