mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgconf: Fix --list-options for forced options
* tools/gpgconf-comp.c (retrieve_options_from_program): Ignore to to ignored options. Add failsafe code to avoid calling percent_escape with NULL. -- Remember: When using ARGPARSE_FLAG_WITHATTR the ARGPARSE_OPT_IGNORE flags in the returned type needs to be considered. GnuPG-bug-id: 5800
This commit is contained in:
parent
0b4fdbd5f4
commit
8fb23094c2
@ -2071,6 +2071,8 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
/* pargs.r_type? pargs.r.ret_str: "[cmdline]"); */
|
||||
continue;
|
||||
}
|
||||
if ((pargs.r_type & ARGPARSE_OPT_IGNORE))
|
||||
continue;
|
||||
|
||||
/* We only have the short option. Search in the option table
|
||||
* for the long option name. */
|
||||
@ -2111,7 +2113,10 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
opt_value = xasprintf ("%lu", pargs.r.ret_ulong);
|
||||
break;
|
||||
case ARGPARSE_TYPE_STRING:
|
||||
opt_value = xasprintf ("\"%s", gc_percent_escape (pargs.r.ret_str));
|
||||
if (!pargs.r.ret_str)
|
||||
opt_value = xstrdup ("\"(none)"); /* We should not see this. */
|
||||
else
|
||||
opt_value = xasprintf ("\"%s", gc_percent_escape (pargs.r.ret_str));
|
||||
break;
|
||||
default: /* ARGPARSE_TYPE_NONE or any unknown type. */
|
||||
opt_value = xstrdup ("1"); /* Make sure we have some value. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user