From 31ff1ee3d4b344a5c17fb04f5cf100db6222ecf0 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 28 Apr 2019 20:44:34 +0200 Subject: diskfs: Fix rename_dir(excl=1) for source directories Starting from coreutils 8.30 which uses renameat2(flag=RENAME_NOREPLACE), we need to have excl=1 to behave correctly, notably in this case: $ mkdir a $ mkdir b $ touch b/t $ mv b a diskfs_rename("b", "a", excl=1) called by mv shall return EEXIST. * libdiskfs/diskfs.h (diskfs_rename_dir): Add `excl' parameter. * doc/hurd.texi (diskfs_rename_dir): Document `excl' parameter. * libdiskfs/dir-renamed.c (diskfs_rename_dir): Add `excl' parameter. Return EEXIST when target exists and `excl' is not 0. * libdiskfs/dir-rename.c (diskfs_S_dir_rename): Pass `excl' to diskfs_rename_dir. --- libdiskfs/dir-rename.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdiskfs/dir-rename.c') diff --git a/libdiskfs/dir-rename.c b/libdiskfs/dir-rename.c index 9ac48398..90f7c683 100644 --- a/libdiskfs/dir-rename.c +++ b/libdiskfs/dir-rename.c @@ -80,7 +80,7 @@ diskfs_S_dir_rename (struct protid *fromcred, goto try_again; } err = diskfs_rename_dir (fdp, fnp, fromname, tdp, toname, fromcred, - tocred); + tocred, excl); if (diskfs_synchronous) { pthread_mutex_lock (&fdp->lock); -- cgit v1.2.3