diff --git a/src/decrypt.c b/src/decrypt.c index 896a873f..e5d2f7c7 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -377,7 +377,9 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, switch (code) { case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/encrypt.c b/src/encrypt.c index c5f668ea..241748cd 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -126,7 +126,9 @@ _gpgme_encrypt_status_handler (void *priv, gpgme_status_code_t code, switch (code) { case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/export.c b/src/export.c index d5137866..090db8b5 100644 --- a/src/export.c +++ b/src/export.c @@ -116,7 +116,9 @@ export_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; default: diff --git a/src/genkey.c b/src/genkey.c index 77576b18..89e1d985 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -172,7 +172,9 @@ genkey_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/keylist.c b/src/keylist.c index 2f6ae824..1d8c8184 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -150,7 +150,9 @@ keylist_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); if (opd->failure_code && !strcmp (args, "option-parser") && gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) err = gpg_error (GPG_ERR_INV_ENGINE); diff --git a/src/keysign.c b/src/keysign.c index 44ab5ff2..1a3c8a54 100644 --- a/src/keysign.c +++ b/src/keysign.c @@ -113,7 +113,9 @@ keysign_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/passwd.c b/src/passwd.c index 0ba8c08d..b29b29c7 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -97,7 +97,9 @@ passwd_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/revsig.c b/src/revsig.c index 8c61f730..1d0276a8 100644 --- a/src/revsig.c +++ b/src/revsig.c @@ -101,7 +101,9 @@ revsig_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/setexpire.c b/src/setexpire.c index 5161499a..ed09f5f9 100644 --- a/src/setexpire.c +++ b/src/setexpire.c @@ -96,7 +96,9 @@ setexpire_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/sign.c b/src/sign.c index 51f581ca..1563c1dd 100644 --- a/src/sign.c +++ b/src/sign.c @@ -363,7 +363,9 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/tofupolicy.c b/src/tofupolicy.c index 79593186..24aaf285 100644 --- a/src/tofupolicy.c +++ b/src/tofupolicy.c @@ -97,7 +97,9 @@ tofu_policy_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: diff --git a/src/verify.c b/src/verify.c index 3ae94c65..8d87cad3 100644 --- a/src/verify.c +++ b/src/verify.c @@ -1055,7 +1055,9 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args) return parse_error (sig, args, !!sig ); case GPGME_STATUS_FAILURE: - opd->failure_code = _gpgme_parse_failure (args); + if (!opd->failure_code + || gpg_err_code (opd->failure_code) == GPG_ERR_GENERAL) + opd->failure_code = _gpgme_parse_failure (args); break; case GPGME_STATUS_EOF: