1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

gpg: Print a new FAILURE status after most commands.

* common/status.h (STATUS_FAILURE): New.
* g10/cpr.c (write_status_failure): New.
* g10/gpg.c (main): Call write_status_failure for all commands which
print an error message here.
--

This status line can be used similar to the error code returned by
commands send over the Assuan interface in gpgsm.  We don't emit them
in gpgsm because there we already have that Assuan interface to return
proper error code.  This change helps GPGME to return better error
codes.

(backported from master 9cdff09743)

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-09-08 15:29:59 +02:00
parent 0b01bb7f25
commit 77f2964b96
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 94 additions and 19 deletions

View file

@ -303,6 +303,20 @@ write_status_begin_signing (gcry_md_hd_t md)
}
/* Write a FAILURE status line. */
void
write_status_failure (const char *where, gpg_error_t err)
{
if (!statusfp || !status_currently_allowed (STATUS_FAILURE))
return; /* Not enabled or allowed. */
fprintf (statusfp, "[GNUPG:] %s %s %u\n",
get_status_string (STATUS_FAILURE), where, err);
if (fflush (statusfp) && opt.exit_on_status_write_error)
g10_exit (0);
}
static int
myread(int fd, void *buf, size_t count)
{