summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-bootloader-grub2.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-07-31 21:31:45 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2016-08-03 08:10:27 +0000
commita843d16de22343bc55f0f584a77b5f5587e4ea23 (patch)
treed5949ca5039f69ca1a8d0432ff72bb5783d93139 /src/libostree/ostree-bootloader-grub2.c
parentc671c1dd3e48927a7c545ade4dec80d7dff5beda (diff)
downloadostree-a843d16de22343bc55f0f584a77b5f5587e4ea23.tar.gz
grub2: Port away from gs_file_sync_data()
Inlining this is uglier, but this code kind of sucks anyways =( We're going to need to do some fd-relative porting in here at some point. Closes: #424 Approved by: giuseppe
Diffstat (limited to 'src/libostree/ostree-bootloader-grub2.c')
-rw-r--r--src/libostree/ostree-bootloader-grub2.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c
index 30edb7a5..b2c68ac9 100644
--- a/src/libostree/ostree-bootloader-grub2.c
+++ b/src/libostree/ostree-bootloader-grub2.c
@@ -389,8 +389,18 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
goto out;
/* Now let's fdatasync() for the new file */
- if (!gs_file_sync_data (new_config_path, cancellable, error))
- goto out;
+ { glnx_fd_close int new_config_fd = open (gs_file_get_path_cached (new_config_path), O_RDONLY | O_CLOEXEC);
+ if (new_config_fd < 0)
+ {
+ glnx_set_prefix_error_from_errno (error, "Opening %s", gs_file_get_path_cached (new_config_path));
+ goto out;
+ }
+ if (fdatasync (new_config_fd) < 0)
+ {
+ glnx_set_error_from_errno (error);
+ goto out;
+ }
+ }
if (self->is_efi)
{