mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-09 07:16:11 -04:00
rename: create whiteout before doing the renameat
so we don't uncover files from the lower layers if the whiteout cannot be created. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
6c74e33cca
commit
7dcef0769b
4
main.c
4
main.c
@ -622,13 +622,13 @@ hide_node (struct ovl_data *lo, struct ovl_node *node, bool unlink_src)
|
|||||||
if (syscall (SYS_renameat2, node_dirfd (node), node->path, lo->workdir_fd,
|
if (syscall (SYS_renameat2, node_dirfd (node), node->path, lo->workdir_fd,
|
||||||
newpath, RENAME_WHITEOUT) < 0)
|
newpath, RENAME_WHITEOUT) < 0)
|
||||||
{
|
{
|
||||||
if (renameat (node_dirfd (node), node->path, lo->workdir_fd, newpath) < 0)
|
|
||||||
return -1;
|
|
||||||
if (node->parent)
|
if (node->parent)
|
||||||
{
|
{
|
||||||
if (create_whiteout (lo, node->parent, node->name, false, false) < 0)
|
if (create_whiteout (lo, node->parent, node->name, false, false) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (renameat (node_dirfd (node), node->path, lo->workdir_fd, newpath) < 0)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user