diff options
author | Colin Walters <walters@verbum.org> | 2017-09-05 21:03:18 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-09-07 15:55:16 +0000 |
commit | 6578c362fe7d1a18c6622c2ba4eb8ab9257cc45e (patch) | |
tree | 0a278ca763422c59956bb1b109f392bc788bcc80 /src/libostree/ostree-gpg-verifier.c | |
parent | 1f6fc009f7344365ba3b4d6fcdf6178be38b3171 (diff) | |
download | ostree-6578c362fe7d1a18c6622c2ba4eb8ab9257cc45e.tar.gz |
lib/gpg: Use nicer helper for gpg error messages
The vast majority of invocations of `ot_gpgme_error_to_gio_error()` were paired
with `g_prefix_error()`; let's combine them for the same reason we do
`glnx_throw_errno_prefix()`. For the few cases that don't we might as well add
some prefix.
I also changed it to `return FALSE` in prep for more style porting.
Closes: #1135
Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-gpg-verifier.c')
-rw-r--r-- | src/libostree/ostree-gpg-verifier.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libostree/ostree-gpg-verifier.c b/src/libostree/ostree-gpg-verifier.c index 99756e2b..d7778cf0 100644 --- a/src/libostree/ostree-gpg-verifier.c +++ b/src/libostree/ostree-gpg-verifier.c @@ -187,14 +187,14 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier *self, gpg_error = gpgme_data_new_from_fd (&kdata, fd); if (gpg_error != GPG_ERR_NO_ERROR) { - ot_gpgme_error_to_gio_error (gpg_error, error); + ot_gpgme_throw (gpg_error, error, "Loading data from fd %i", fd); goto out; } gpg_error = gpgme_op_import (result->context, kdata); if (gpg_error != GPG_ERR_NO_ERROR) { - ot_gpgme_error_to_gio_error (gpg_error, error); + ot_gpgme_throw (gpg_error, error, "Failed to import key"); goto out; } } @@ -212,8 +212,7 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier *self, 0 /* do not copy */); if (gpg_error != GPG_ERR_NO_ERROR) { - ot_gpgme_error_to_gio_error (gpg_error, error); - g_prefix_error (error, "Unable to read signed data: "); + ot_gpgme_throw (gpg_error, error, "Unable to read signed data"); goto out; } @@ -223,16 +222,14 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier *self, 0 /* do not copy */); if (gpg_error != GPG_ERR_NO_ERROR) { - ot_gpgme_error_to_gio_error (gpg_error, error); - g_prefix_error (error, "Unable to read signature: "); + ot_gpgme_throw (gpg_error, error, "Unable to read signature"); goto out; } gpg_error = gpgme_op_verify (result->context, signature_buffer, data_buffer, NULL); if (gpg_error != GPG_ERR_NO_ERROR) { - ot_gpgme_error_to_gio_error (gpg_error, error); - g_prefix_error (error, "Unable to complete signature verification: "); + ot_gpgme_throw (gpg_error, error, "Unable to complete signature verification"); goto out; } |