summaryrefslogtreecommitdiffstats
path: root/g10/cpr.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2018-04-06 17:32:08 +0200
committerWerner Koch <wk@gnupg.org>2018-04-06 17:32:25 +0200
commit0336e5d1a7b9d46e06c838e6a98aecfcc9542882 (patch)
treefa8cb0d1ab91dbd0b1ee6d280e3f98c2fc3b44ef /g10/cpr.c
parentdoc: Add a code comment about back signatures. (diff)
downloadgnupg2-0336e5d1a7b9d46e06c838e6a98aecfcc9542882.tar.xz
gnupg2-0336e5d1a7b9d46e06c838e6a98aecfcc9542882.zip
gpg: Emit FAILURE stati now in almost all cases.
* g10/cpr.c (write_status_failure): Make it print only once. * g10/gpg.c (wrong_args): Bump error counter. (g10_exit): Print a FAILURE status if we ever did a log_error etc. (main): Use log_error instead of log_fatal at one place. Print a FAILURE status for a bad option. Ditto for certain exit points so that we can see different error locations. -- This makes it easier to detect errors by tools which have no way to get the exit code (e.g. due to double forking). GnuPG-bug-id: 3872 Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/cpr.c')
-rw-r--r--g10/cpr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/g10/cpr.c b/g10/cpr.c
index a7fd1aaba..435442636 100644
--- a/g10/cpr.c
+++ b/g10/cpr.c
@@ -245,9 +245,13 @@ write_status_errcode (const char *where, int errcode)
void
write_status_failure (const char *where, gpg_error_t err)
{
+ static int any_failure_printed;
+
if (!statusfp || !status_currently_allowed (STATUS_FAILURE))
return; /* Not enabled or allowed. */
-
+ if (any_failure_printed)
+ return;
+ any_failure_printed = 1;
es_fprintf (statusfp, "[GNUPG:] %s %s %u\n",
get_status_string (STATUS_FAILURE), where, err);
if (es_fflush (statusfp) && opt.exit_on_status_write_error)