aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-08-29 19:46:00 +0300
committerJoursoir <chat@joursoir.net>2022-08-29 20:35:18 +0300
commit3ad5e444785b46b5b85bf06cc3650474f8d9521e (patch)
tree86cc5dfc14d71adaf5bd5d91ebc88c1d7325f07c
parent162b70fb7e39293025ee8eaf58c50fa4ba30456c (diff)
downloadlock-password-3ad5e444785b46b5b85bf06cc3650474f8d9521e.tar.gz
lock-password-3ad5e444785b46b5b85bf06cc3650474f8d9521e.tar.bz2
lock-password-3ad5e444785b46b5b85bf06cc3650474f8d9521e.zip
r-gpgme: add macro to print gpgme specific error
-rw-r--r--src/r-gpgme.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/r-gpgme.c b/src/r-gpgme.c
index eed2db1..cfa2f98 100644
--- a/src/r-gpgme.c
+++ b/src/r-gpgme.c
@@ -27,6 +27,8 @@
#include "r-gpgme.h"
#include "output.h"
+#define print_gpgme_error(err) print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err))
+
static void init_gpgme()
{
/* The GPGME library communicates with child processes (the
@@ -60,7 +62,7 @@ static int init_ctx(gpgme_ctx_t ctx, gpgme_protocol_t protocol)
return 0;
error:
- print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err));
+ print_gpgme_error(err);
return 1;
}
@@ -84,7 +86,7 @@ static int loop_read(const char *path, gpgme_data_t dh)
out:
if (ret != 0) {
gpgme_error_t err = gpgme_err_code_from_errno(errno);
- print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err));
+ print_gpgme_error(err);
}
fclose(f);
return ret;
@@ -134,7 +136,7 @@ out_release_context:
gpgme_release(ctx);
out:
if (err != GPG_ERR_NO_ERROR) {
- print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err));
+ print_gpgme_error(err);
}
return ret;
}
@@ -183,7 +185,7 @@ out_release_context:
gpgme_release(ctx);
out:
if (err != GPG_ERR_NO_ERROR) {
- print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err));
+ print_gpgme_error(err);
}
return data;
}