core: Ensure file data is synced to disk when checking out via non-hardlinks
Otherwise we aren't crash-safe.
This commit is contained in:
1 parent
e9dd22dc86
commit
238da603b8
1 file changed
+12
-5
@@ -3141,12 +3141,14 @@ checkout_file_from_input (GFile *file,
|
|||||||
|
|
||||||
xattrs = NULL;
|
xattrs = NULL;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
temp_info = g_object_ref (finfo);
|
||||||
|
|
||||||
if (overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES)
|
if (overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES)
|
||||||
{
|
{
|
||||||
if (g_file_info_get_file_type (temp_info ? temp_info : finfo) == G_FILE_TYPE_DIRECTORY)
|
if (g_file_info_get_file_type (temp_info) == G_FILE_TYPE_DIRECTORY)
|
||||||
{
|
{
|
||||||
if (!ostree_create_file_from_input (file, temp_info ? temp_info : finfo,
|
if (!ostree_create_file_from_input (file, temp_info,
|
||||||
xattrs, input,
|
xattrs, input,
|
||||||
cancellable, &temp_error))
|
cancellable, &temp_error))
|
||||||
{
|
{
|
||||||
@@ -3165,8 +3167,7 @@ checkout_file_from_input (GFile *file,
|
|||||||
{
|
{
|
||||||
dir = g_file_get_parent (file);
|
dir = g_file_get_parent (file);
|
||||||
if (!ostree_create_temp_file_from_input (dir, NULL, "checkout",
|
if (!ostree_create_temp_file_from_input (dir, NULL, "checkout",
|
||||||
temp_info ? temp_info : finfo,
|
temp_info, xattrs, input, &temp_file,
|
||||||
xattrs, input, &temp_file,
|
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@@ -3179,11 +3180,17 @@ checkout_file_from_input (GFile *file,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!ostree_create_file_from_input (file, temp_info ? temp_info : finfo,
|
if (!ostree_create_file_from_input (file, temp_info,
|
||||||
xattrs, input, cancellable, error))
|
xattrs, input, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_file_info_get_file_type (temp_info) == G_FILE_TYPE_REGULAR)
|
||||||
|
{
|
||||||
|
if (!ensure_file_data_synced (file, cancellable, error))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in new issue
Block a user