lib: Port away from gs_file_rename()
In one case, we already had relative fds and hence this was nicer. Unfortunately the other areas got uglier. More fd-relative porting to do later. Closes: #424 Approved by: giuseppe
This commit is contained in:
1 parent
52acb9d8e3
commit
c671c1dd3e
2 files changed
+16
-9
No files matched your search
@@ -408,9 +408,11 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
|
||||
*/
|
||||
if (!ot_gfile_ensure_unlinked (self->config_path_efi, cancellable, error))
|
||||
goto out;
|
||||
if (!gs_file_rename (new_config_path, self->config_path_efi,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (rename (gs_file_get_path_cached (new_config_path), gs_file_get_path_cached (self->config_path_efi)) < 0)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
@@ -795,9 +795,12 @@ selinux_relabel_var_if_needed (OstreeSysroot *sysroot,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!gs_file_rename (deployment_var_labeled_tmp, deployment_var_labeled,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (rename (gs_file_get_path_cached (deployment_var_labeled_tmp),
|
||||
gs_file_get_path_cached (deployment_var_labeled)) < 0)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
@@ -861,9 +864,11 @@ merge_configuration (OstreeSysroot *sysroot,
|
||||
else if (etc_exists)
|
||||
{
|
||||
/* Compatibility hack */
|
||||
if (!gs_file_rename (deployment_etc_path, deployment_usretc_path,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (renameat (deployment_dfd, "etc", deployment_dfd, "usr/etc") < 0)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
usretc_exists = TRUE;
|
||||
etc_exists = FALSE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user