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:
parent
b8640a72b8
commit
b188a8a5e3
@ -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 },
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user