summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo@endlessm.com>2015-07-27 17:17:26 -0700
committerColin Walters <walters@verbum.org>2015-07-28 11:35:42 -0400
commita5f266f25dfbab200472e15202830e1b9dccf999 (patch)
tree9c29064b0fb45845aa656f8bde268ba3ffab4998
parent939a7aebfb08124201cd793fdd0fd5ef33ad5c96 (diff)
downloadostree-a5f266f25dfbab200472e15202830e1b9dccf999.tar.gz
repo: don't forget to abort the transaction when failed
ostree_repo_prepare_transaction() should always be matched with a call to either ostree_repo_commit_transaction() or ostree_repo_abort_transaction(). Since ostree_repo_pull_with_options() does not call ostree_repo_abort_transaction() on errors, the OstreeRepo instance will hit an assertion when it's re-used later for another attempt, such as when the update is driven by an external component through libostree and network temporarily goes down. This commit simply always calls ostree_repo_abort_transaction() in the exit path of ostree_repo_pull_with_options(), since the function is safe to call even when we're not in a transaction, and that matches e.g. what ostree-sysroot-cleanup.c does.
-rw-r--r--src/libostree/ostree-repo-pull.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index aa8e6359..5a87847b 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -2191,6 +2191,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
ret = TRUE;
out:
+ ostree_repo_abort_transaction (pull_data->repo, cancellable, NULL);
g_main_context_unref (pull_data->main_context);
if (update_timeout)
g_source_destroy (update_timeout);