summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2015-05-07 17:50:22 -0400
committerMatthew Barnes <mbarnes@redhat.com>2015-05-07 17:50:22 -0400
commitd0edf6334625d9f65917a1bfbe42076f52b0fe8f (patch)
treecdd05796af71bc701a5eac2d83a3b8ad50892a36
parent239f05ecdd8d813bfa322629d7c09a032041cbd9 (diff)
downloadostree-d0edf6334625d9f65917a1bfbe42076f52b0fe8f.tar.gz
repo: Simplify sign_data() a little
Use ot_gpgme_data_output() to wrapper a GOutputStream.
-rw-r--r--src/libostree/ostree-repo.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 4d8a7335..d823725d 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -3108,7 +3108,6 @@ sign_data (OstreeRepo *self,
gpgme_key_t key = NULL;
gpgme_data_t commit_buffer = NULL;
gpgme_data_t signature_buffer = NULL;
- int signature_fd = -1;
GMappedFile *signature_file = NULL;
if (!gs_file_open_in_tmpdir (self->tmp_dir, 0644,
@@ -3179,22 +3178,9 @@ sign_data (OstreeRepo *self,
goto out;
}
}
-
- signature_fd = g_file_descriptor_based_get_fd ((GFileDescriptorBased*)tmp_signature_output);
- if (signature_fd < 0)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Unable to open signature file");
- goto out;
- }
-
- if ((err = gpgme_data_new_from_fd (&signature_buffer, signature_fd)) != GPG_ERR_NO_ERROR)
- {
- ot_gpgme_error_to_gio_error (err, error);
- g_prefix_error (error, "Failed to create buffer for signature file: ");
- goto out;
- }
-
+
+ signature_buffer = ot_gpgme_data_output (tmp_signature_output);
+
if ((err = gpgme_op_sign (context, commit_buffer, signature_buffer, GPGME_SIG_MODE_DETACH))
!= GPG_ERR_NO_ERROR)
{