aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2024-03-11 12:53:18 +0000
committerIngo Klöcker <[email protected]>2024-03-11 12:53:18 +0000
commit7158397c098b8527c97c6bf350c2ebd6c0012594 (patch)
tree947ad0428123cab0f461b3ed0745f18a3c755812
parentqt: Add function for synchronously executing ExportJob (diff)
downloadgpgme-7158397c098b8527c97c6bf350c2ebd6c0012594.tar.gz
gpgme-7158397c098b8527c97c6bf350c2ebd6c0012594.zip
core: Check STATUS_FAILURE in import operations.
* src/import.c (op_data_t): Add failure_code. (_gpgme_import_status_handler): Set it. Return it on EOF. -- GnuPG-bug-id: 7036
-rw-r--r--src/import.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/import.c b/src/import.c
index f46313c7..f288a811 100644
--- a/src/import.c
+++ b/src/import.c
@@ -37,6 +37,9 @@ typedef struct
{
struct _gpgme_op_import_result result;
+ /* The error code from a FAILURE status line or 0. */
+ gpg_error_t failure_code;
+
/* A pointer to the next pointer of the last import status in the
list. This makes appending new imports painless while preserving
the order. */
@@ -309,6 +312,17 @@ _gpgme_import_status_handler (void *priv, gpgme_status_code_t code, char *args)
opd->lastp = &(*opd->lastp)->next;
break;
+ case GPGME_STATUS_FAILURE:
+ 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:
+ if (opd->failure_code)
+ return opd->failure_code;
+ break;
+
default:
break;
}