main: honor FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT also for renames

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-03-05 14:56:55 +01:00
parent 0d77a9fdd0
commit 062ec18711
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

14
main.c
View File

@ -4532,9 +4532,17 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name,
/* Try to create the whiteout atomically, if it fails do the
rename+mknod separately. */
ret = direct_renameat2 (srcfd, name, destfd,
newname, flags|RENAME_WHITEOUT);
/* If the destination is a whiteout, just overwrite it. */
if (! can_mknod)
{
ret = -1;
errno = EPERM;
}
else
{
ret = direct_renameat2 (srcfd, name, destfd,
newname, flags|RENAME_WHITEOUT);
}
/* If the destination is a whiteout, just overwrite it. */
if (ret < 0 && errno == EEXIST)
ret = direct_renameat2 (srcfd, name, destfd, newname, flags & ~RENAME_NOREPLACE);
if (ret < 0)