From 152dcf89b59b75a78f9c03b65773dcae13f105ad Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 24 Feb 2015 13:39:22 -0500 Subject: [PATCH] repo: detached sigs: Use error prefixing instead of overwriting Noted when "rpm-ostree compose sign" failed to write to a repo due to permissions. --- src/libostree/ostree-repo-commit.c | 6 +++++- src/libostree/ostree-repo.c | 12 ++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 97ff7453..9d8bf8bd 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -1925,6 +1925,7 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo *self, } else { + g_prefix_error (error, "Unable to read existing detached metadata: "); g_propagate_error (error, temp_error); goto out; } @@ -1971,7 +1972,10 @@ ostree_repo_write_commit_detached_metadata (OstreeRepo *self, g_variant_get_size (normalized), NULL, FALSE, 0, NULL, cancellable, error)) - goto out; + { + g_prefix_error (error, "Unable to write detached metadata: "); + goto out; + } ret = TRUE; out: diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 32524d22..a05d481d 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -2995,11 +2995,7 @@ ostree_repo_append_gpg_signature (OstreeRepo *self, &metadata, cancellable, error)) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Unable to read existing detached metadata"); - goto out; - } + goto out; new_metadata = _ostree_detached_metadata_append_gpg_sig (metadata, signature_bytes); @@ -3008,11 +3004,7 @@ ostree_repo_append_gpg_signature (OstreeRepo *self, new_metadata, cancellable, error)) - { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Unable to read existing detached metadata"); - goto out; - } + goto out; ret = TRUE; out: