diff options
| author | Werner Koch <[email protected]> | 2026-04-30 13:56:28 +0200 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2026-04-30 13:56:28 +0200 |
| commit | 69c27fe3778754ef7b440bf97a17d709f295e044 (patch) | |
| tree | c6e8ff9140a49d7ebc901ee0437a7b407e00c945 /sm | |
| parent | gpgsm: Make --with-ephemeral work correct with the keyboxd. (diff) | |
| download | gnupg-69c27fe3778754ef7b440bf97a17d709f295e044.tar.gz gnupg-69c27fe3778754ef7b440bf97a17d709f295e044.zip | |
gpgsm: Avoid a final FAILURE status line w/o unsing --status-fd
* sm/gpgsm.c (no_final_failure_status): New.
(main): Set it.
(gpgsm_exit): Use it.
Diffstat (limited to 'sm')
| -rw-r--r-- | sm/gpgsm.c | 12 | ||||
| -rw-r--r-- | sm/server.c | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c index a399e9abf..952318107 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -525,6 +525,9 @@ int assert_validsig_true = 0; /* It is possible that we are currentlu running under setuid permissions */ static int maybe_setuid = 1; +/* If this flag is set the final exit status line will not be printed. */ +static int no_final_failure_status; + /* Helper to implement --debug-level and --debug*/ static const char *debug_level; static unsigned int debug_value; @@ -1698,6 +1701,13 @@ main ( int argc, char **argv) gcry_control (GCRYCTL_RESUME_SECMEM_WARN); + /* If we are not running in server mode and --status-fd has not been + * used we should not emit a final status line. This extra flag is + * required because gpgsm_status is not used for the final fallback + * failure status. */ + if (cmd != aServer && ctrl.status_fd == -1) + no_final_failure_status = 1; + set_debug (); if (opt.verbose) /* Print the compatibility flags. */ parse_compatibility_flags (NULL, &opt.compat_flags, compatibility_flags); @@ -2377,7 +2387,7 @@ gpgsm_exit (int rc) /* If we had an error but not printed an error message, do it now. * Note that the function will never print a second failure status * line. */ - if (rc) + if (rc && !no_final_failure_status) gpgsm_exit_failure_status (); gcry_control (GCRYCTL_UPDATE_RANDOM_SEED_FILE); diff --git a/sm/server.c b/sm/server.c index c0542dc9a..b83410f0c 100644 --- a/sm/server.c +++ b/sm/server.c @@ -1635,7 +1635,9 @@ gpgsm_status_with_error (ctrl_t ctrl, int no, const char *text, } -/* Function to print a FAILURE status line on exit. */ +/* Function to print a FAILURE status line on exit. This is quite + * special and only used by gpgsm_exit - it needs to be here because + * of the considered global variables. */ void gpgsm_exit_failure_status (void) { |
