diff options
author | Werner Koch <[email protected]> | 2022-01-25 18:05:16 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2022-01-25 18:05:16 +0000 |
commit | d8e6d1e9ed7d181f546426269ab7b04e184bb9a1 (patch) | |
tree | 75b76877fa337fdfa46a9a3db686398566602685 | |
parent | scd: Also prefer Yubikeys if no reader port is given. (diff) | |
download | gnupg-d8e6d1e9ed7d181f546426269ab7b04e184bb9a1.tar.gz gnupg-d8e6d1e9ed7d181f546426269ab7b04e184bb9a1.zip |
common: Fix returning of option attributes for options with args.
* common/argparse.c (gnupg_argparse): Set attribute flags
--
GnuPG-bug-id: 5799
This is a backport from the fix in libgpg-error in case gnupg 2.2 is
build against an older version of libgpg-error.
-rw-r--r-- | common/argparse.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/argparse.c b/common/argparse.c index fb2bc6556..b63f800e8 100644 --- a/common/argparse.c +++ b/common/argparse.c @@ -1344,6 +1344,17 @@ gnupg_argparse (estream_t fp, gnupg_argparse_t *arg, gnupg_opt_t *opts_orig) xfree (buffer); else gpgrt_annotate_leaked_object (buffer); + /* If the caller wants us to return the attributes or + * ignored options, or these flags in. */ + if ((arg->flags & ARGPARSE_FLAG_WITHATTR)) + { + if (opts[idx].ignore) + arg->r_type |= ARGPARSE_ATTR_IGNORE; + if (opts[idx].forced) + arg->r_type |= ARGPARSE_ATTR_FORCE; + if (set_ignore) + arg->r_type |= ARGPARSE_OPT_IGNORE; + } } } goto leave; |