[ostree] repo: Clean up temporaries after a transaction completes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Clean up temporaries after a transaction completes
- Date: Tue, 27 Aug 2013 15:37:08 +0000 (UTC)
commit d58a4c9f79f248edbcc4b40f82c060c559e30378
Author: Jeremy Whiting <jpwhiting kde org>
Date: Mon Aug 26 15:44:06 2013 -0600
repo: Clean up temporaries after a transaction completes
Prevously, we were just leaving temporary files there forever if
a transaction was interrupted.
https://bugzilla.gnome.org/show_bug.cgi?id=706344
src/libostree/ostree-repo.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 51c833d..53fd3b0 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -995,6 +995,7 @@ ostree_repo_commit_transaction_with_stats (OstreeRepo *self,
GError **error)
{
gboolean ret = FALSE;
+ gs_unref_object GFileEnumerator *enumerator = NULL;
g_return_val_if_fail (self->in_transaction == TRUE, FALSE);
@@ -1010,6 +1011,30 @@ ostree_repo_commit_transaction_with_stats (OstreeRepo *self,
if (out_content_objects_total) *out_content_objects_total = self->txn_content_objects_total;
if (out_content_objects_written) *out_content_objects_written = self->txn_content_objects_written;
if (out_content_bytes_written) *out_content_bytes_written = self->txn_content_bytes_written;
+ enumerator = g_file_enumerate_children (self->tmp_dir,
"standard::name,standard::type,unix::inode,unix::nlink",
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ cancellable,
+ error);
+ if (!enumerator)
+ goto out;
+
+ while (TRUE)
+ {
+ GFileInfo *file_info;
+ guint32 nlinks;
+ gs_unref_object GFile *objpath = NULL;
+
+ if (!gs_file_enumerator_iterate (enumerator, &file_info, NULL,
+ cancellable, error))
+ goto out;
+ if (file_info == NULL)
+ break;
+
+ objpath = g_file_get_child (self->tmp_dir, g_file_info_get_name (file_info));
+ if (!gs_file_unlink (objpath, cancellable, error))
+ goto out;
+ }
+
ret = TRUE;
out:
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]