Skip to content

Commit b188a8a

Browse files
author
Artur Zakirov
committed
Fix handling of unrecognized options
1 parent b8640a7 commit b188a8a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pg_probackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static pgut_option options[] =
7575
{ 's', 5, "inclusive", &target_inclusive, SOURCE_CMDLINE },
7676
{ 'u', 6, "timeline", &target_tli, SOURCE_CMDLINE },
7777
/* delete options */
78-
{ 'b', 12, "wal", &delete_wal },
78+
{ 'b', 12, "wal", &delete_wal, SOURCE_CMDLINE },
7979
/* retention options */
8080
{ 'u', 13, "redundancy", &retention_redundancy, SOURCE_CMDLINE },
8181
{ 'u', 14, "window", &retention_window, SOURCE_CMDLINE },

pgut/pgut.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,10 @@ pgut_getopt(int argc, char **argv, pgut_option options[])
631631
while ((c = getopt_long(argc, argv, optstring, longopts, &optindex)) != -1)
632632
{
633633
opt = option_find(c, default_options, options);
634-
if (opt->allowed < SOURCE_CMDLINE)
634+
if (opt && opt->allowed < SOURCE_CMDLINE)
635635
elog(ERROR, "option %s cannot be specified in command line",
636636
opt->lname);
637+
/* Check 'opt == NULL' is performed in assign_option() */
637638
assign_option(opt, optarg, SOURCE_CMDLINE);
638639
}
639640

0 commit comments

Comments
 (0)