From 3918ae351db67dd77a393b48e59a487e29febbd9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 25 Oct 2004 05:27:15 +0000 Subject: r3192: make sure we don't call pvfs_can_delete() until after we have confirmed that name->exists it true (This used to be commit d368d2f4fe23bdc13f6b9bbdc044dd158ab61169) --- source4/ntvfs/posix/pvfs_rename.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source4/ntvfs/posix') diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c index 6116f6c7bf..ad69f092ad 100644 --- a/source4/ntvfs/posix/pvfs_rename.c +++ b/source4/ntvfs/posix/pvfs_rename.c @@ -48,16 +48,6 @@ NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs, return status; } - status = pvfs_can_delete(pvfs, name1); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - status = pvfs_can_delete(pvfs, name2); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - if (name1->has_wildcard || name2->has_wildcard) { DEBUG(3,("Rejecting wildcard rename '%s' -> '%s'\n", ren->rename.in.pattern1, ren->rename.in.pattern2)); @@ -72,6 +62,11 @@ NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs, return NT_STATUS_OBJECT_NAME_COLLISION; } + status = pvfs_can_delete(pvfs, name1); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + if (rename(name1->full_name, name2->full_name) == -1) { return pvfs_map_errno(pvfs, errno); } -- cgit