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.
This commit is contained in:
Werner Koch 2022-01-25 19:05:16 +01:00
parent 38c666ec3f
commit d8e6d1e9ed
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 11 additions and 0 deletions

View File

@ -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;