gpgme: fix gpg_error_t and gpg_err_code_t confusion

NIIBE Yutaka gniibe at fsij.org
Thu Oct 15 02:31:24 CEST 2015


Hello,

Handling the issue 2074 [0] for libgcrypt, I review the patch
submitted [1].  (Note that the discussion in the issue and
the patch is a sort of independent.)

I applied it and then fixed the change (reverting a part of the
original change), both for master and LIBGCRYPT-1-6-BRANCH.

It is fixing gpg_error_t and gpg_err_code_t confusion.  I also fixed
similar bug in gnupg master.  Those fixes are already pushed, since
they are obvious simple fixes.

[0] https://bugs.gnupg.org/gnupg/issue2074
[1] https://bugs.gnupg.org/gnupg/file692/patch-sunstudio

Then, I found similar mistakes in gpgme.  Although it's obvious fix,
I haven't had an experience to push to gpgme repository.  Thus, I ask
if it is OK to push this fix to gpgme repo.

========================================
diff --git a/src/data-compat.c b/src/data-compat.c
index 99827f1..abb7863 100644
--- a/src/data-compat.c
+++ b/src/data-compat.c
@@ -146,7 +146,7 @@ gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy)
 static int
 gpgme_error_to_errno (gpgme_error_t err)
 {
-  int res = gpg_err_code_to_errno (err);
+  int res = gpg_err_code_to_errno (gpg_err_code (err));

   if (!err)
     {
diff --git a/src/gpgme.c b/src/gpgme.c
index 343e775..3c4e8e9 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -91,7 +91,7 @@ gpgme_new (gpgme_ctx_t *r_ctx)
   TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx);

   if (_gpgme_selftest)
-    return TRACE_ERR (gpgme_error (_gpgme_selftest));
+    return TRACE_ERR (_gpgme_selftest);

   if (!r_ctx)
     return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
-- 



More information about the Gnupg-devel mailing list