[ostree] deploy: Ensure .origin file is fsync()ed on disk
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] deploy: Ensure .origin file is fsync()ed on disk
- Date: Fri, 11 Apr 2014 22:45:20 +0000 (UTC)
commit 053dd72649307075938d773e266988f46d5f5c49
Author: Colin Walters <walters verbum org>
Date: Tue Apr 8 18:21:19 2014 -0400
deploy: Ensure .origin file is fsync()ed on disk
Along with its parent directory.
src/libostree/ostree-sysroot-deploy.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index 0856cc1..889342a 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -576,16 +576,21 @@ write_origin_file (OstreeSysroot *sysroot,
{
gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
+ gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path);
gs_free char *contents = NULL;
gsize len;
+ gs_unref_bytes GBytes *contents_bytes = NULL;
contents = g_key_file_to_data (origin, &len, error);
if (!contents)
goto out;
+ contents_bytes = g_bytes_new_static (contents, len);
- if (!g_file_replace_contents (origin_path, contents, len, NULL, FALSE,
- G_FILE_CREATE_REPLACE_DESTINATION, NULL,
- cancellable, error))
+ if (!ot_gfile_replace_contents_fsync (origin_path, contents_bytes,
+ cancellable, error))
+ goto out;
+
+ if (!ot_util_fsync_directory (origin_parent, cancellable, error))
goto out;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]