1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-11 03:54:59 -05:00

Correctly check the GPG error codes

The error code is in fact a bitmask value of an error code and an error
source, so use the proper function to get only the relevant bits. For
the no error case, this shouldn't ever matter, but it bit me when I was
trying to compare the error code to other values and wondered why it
wasn't working, so set a good example.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-07-01 15:51:21 -05:00
parent 7af0ab1cde
commit e8443b1685

View File

@ -39,7 +39,7 @@
#if HAVE_LIBGPGME #if HAVE_LIBGPGME
#define CHECK_ERR(void) do { \ #define CHECK_ERR(void) do { \
if(err != GPG_ERR_NO_ERROR) { goto error; } \ if(gpg_err_code(err) != GPG_ERR_NO_ERROR) { goto error; } \
} while(0) } while(0)
static const char *string_validity(gpgme_validity_t validity) static const char *string_validity(gpgme_validity_t validity)
@ -383,7 +383,7 @@ error:
} }
FREE(sigpath); FREE(sigpath);
FREE(decoded_sigdata); FREE(decoded_sigdata);
if(err != GPG_ERR_NO_ERROR) { if(gpg_err_code(err) != GPG_ERR_NO_ERROR) {
_alpm_log(handle, ALPM_LOG_ERROR, _("GPGME error: %s\n"), gpgme_strerror(err)); _alpm_log(handle, ALPM_LOG_ERROR, _("GPGME error: %s\n"), gpgme_strerror(err));
RET_ERR(handle, ALPM_ERR_GPGME, -1); RET_ERR(handle, ALPM_ERR_GPGME, -1);
} }