bootloader: fdatasync() bootloader configuration
Let's be a bit more conservative here and actually fdatasync() the configurations we're generating. I'm seeing an issue at the moment where syslinux isn't finding the config sometimes, and while I don't think this is the issue, let's try it.
This commit is contained in:
1 parent
cc8bacf8b4
commit
829e0382ab
4 files changed
+82
-10
No files matched your search
@@ -236,12 +236,15 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
|
||||
goto out;
|
||||
|
||||
new_config_contents = _ostree_sysroot_join_lines (new_lines);
|
||||
{
|
||||
gs_unref_bytes GBytes *new_config_contents_bytes =
|
||||
g_bytes_new_static (new_config_contents,
|
||||
strlen (new_config_contents));
|
||||
|
||||
if (!g_file_replace_contents (new_config_path, new_config_contents,
|
||||
strlen (new_config_contents),
|
||||
NULL, FALSE, G_FILE_CREATE_NONE,
|
||||
NULL, cancellable, error))
|
||||
goto out;
|
||||
if (!ot_gfile_replace_contents_fsync (new_config_path, new_config_contents_bytes,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
|
||||
@@ -124,12 +124,15 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
|
||||
return FALSE;
|
||||
|
||||
new_config_contents = _ostree_sysroot_join_lines (new_lines);
|
||||
{
|
||||
gs_unref_bytes GBytes *new_config_contents_bytes =
|
||||
g_bytes_new_static (new_config_contents,
|
||||
strlen (new_config_contents));
|
||||
|
||||
if (!g_file_replace_contents (new_config_path, new_config_contents,
|
||||
strlen (new_config_contents),
|
||||
NULL, FALSE, G_FILE_CREATE_NONE,
|
||||
NULL, cancellable, error))
|
||||
return FALSE;
|
||||
if (!ot_gfile_replace_contents_fsync (new_config_path, new_config_contents_bytes,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user