]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:vfs_crossrename: add back checking for errno ENOENT
authorJones Syue <jonessyue@qnap.com>
Thu, 26 Sep 2024 09:17:14 +0000 (17:17 +0800)
committerPavel Filipensky <pfilipensky@samba.org>
Tue, 17 Dec 2024 10:27:34 +0000 (10:27 +0000)
strace gives a clue: samba try to remove 'file.txt' in the dst folder but
actually it is not existed yet, and got an errno = ENOENT,

renameat(32, "file.txt", 31, "file.txt") = -1 EXDEV (Invalid cross-device link)
unlinkat(31, "file.txt", 0)             = -1 ENOENT (No such file or directory)

Commit 5c18f074be92 ("s3: VFS: crossrename. Use real dirfsp for
SMB_VFS_RENAMEAT()") seems unintentionally removed errno ENOENT checking,
so add it back could address 1st issue.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15724

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_crossrename.c

index 5c6006931864c46d20b6010dd1c194884c252eb5..0ce4b44898def575bdce9cf68f111ac83159c7d3 100644 (file)
@@ -85,7 +85,7 @@ static NTSTATUS copy_reg(vfs_handle_struct *handle,
                                    dstfsp,
                                    dest,
                                    0);
-       if (ret == -1) {
+       if (ret == -1 && errno != ENOENT) {
                status = map_nt_error_from_unix(errno);
                goto out;
        }