From 7cc4a20f3bb7a02ac3c1e2d9ef1ed0c9fa49b2f6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 29 Apr 2014 09:02:43 -0400 Subject: [PATCH] pull: Correctly handle error state when fetching optional data For the static deltas work, we're using the already-extant internal API to perform a HTTP fetch for optional data - static deltas are optional. Except that we didn't correctly unset the error if we were doing an optional fetch and the data wasn't found. --- src/libostree/ostree-repo-pull.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 0d9eaf8b..427bd924 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -293,11 +293,14 @@ fetch_uri_contents_membuf_sync (OtPullData *pull_data, run_mainloop_monitor_fetcher (pull_data); if (!fetch_data.result_stream) { - if (allow_noent && g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) + if (allow_noent) { - g_clear_error (error); - ret = TRUE; - *out_contents = NULL; + if (g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) + { + g_clear_error (error); + ret = TRUE; + *out_contents = NULL; + } } goto out; }