diff options
author | Werner Koch <[email protected]> | 2020-02-25 11:17:25 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-02-25 11:17:25 +0000 |
commit | f25555aed0da7f0492b68efb789dbe3e03ec7fe8 (patch) | |
tree | c723e91afa383df45e52e03e79a41b935f983b1d | |
parent | w32: Fix exporting gpgrt_argparser. (diff) | |
download | libgpg-error-f25555aed0da7f0492b68efb789dbe3e03ec7fe8.tar.gz libgpg-error-f25555aed0da7f0492b68efb789dbe3e03ec7fe8.zip |
core: New pseudo option ARGPARSE_PERMISSION_ERROR.
* src/gpg-error.h.in (ARGPARSE_PERMISSION_ERROR): New.
* src/argparse.c (initialize): Add code to print this error.
--
We need this option to reject certain config files if we detect a
permission problem.
Signed-off-by: Werner Koch <[email protected]>
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/argparse.c | 4 | ||||
-rw-r--r-- | src/gpg-error.h.in | 1 |
3 files changed, 6 insertions, 0 deletions
@@ -13,6 +13,7 @@ Noteworthy changes in version 1.38 (unreleased) [C28/A28/R_] ARGPARSE_NO_CONFFILE NEW. ARGPARSE_CONFFILE NEW. ARGPARSE_OPT_CONFFILE NEW. + ARGPARSE_PERMISSION_ERROR NEW. ARGPARSE_conffile NEW. ARGPARSE_noconffile NEW. GPGRT_CONFDIR_USER NEW. diff --git a/src/argparse.c b/src/argparse.c index 837d153..04c8291 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -386,6 +386,8 @@ initialize (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, estream_t fp) s = _("invalid command"); else if ( arg->r_opt == ARGPARSE_INVALID_ALIAS ) s = _("invalid alias definition"); + else if ( arg->r_opt == ARGPARSE_PERMISSION_ERROR ) + s = _("permission error"); else if ( arg->r_opt == ARGPARSE_OUT_OF_CORE ) s = _("out of core"); else if ( arg->r_opt == ARGPARSE_NO_CONFFILE ) @@ -415,6 +417,8 @@ initialize (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, estream_t fp) _gpgrt_log_error (_("command \"%.50s\" is ambiguous\n"),s ); else if ( arg->r_opt == ARGPARSE_OUT_OF_CORE ) _gpgrt_log_error ("%s\n", _("out of core")); + else if ( arg->r_opt == ARGPARSE_PERMISSION_ERROR ) + _gpgrt_log_error ("%s\n", _("permission error")); else if ( arg->r_opt == ARGPARSE_NO_CONFFILE) ; /* Error has already been printed. */ else diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index d812326..f8c294d 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -1202,6 +1202,7 @@ typedef struct #define ARGPARSE_INVALID_ALIAS (-10) #define ARGPARSE_OUT_OF_CORE (-11) #define ARGPARSE_INVALID_ARG (-12) +#define ARGPARSE_PERMISSION_ERROR (-13) #define ARGPARSE_NO_CONFFILE (-14) #define ARGPARSE_CONFFILE (-15) |