r3192: make sure we don't call pvfs_can_delete() until after we have confirmed that...
authorAndrew Tridgell <tridge@samba.org>
Mon, 25 Oct 2004 05:27:15 +0000 (05:27 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:04:39 +0000 (13:04 -0500)
it true
(This used to be commit d368d2f4fe23bdc13f6b9bbdc044dd158ab61169)

source4/ntvfs/posix/pvfs_rename.c

index 6116f6c7bfbe2198f3c9e53cfc3e2d49a5a84bfb..ad69f092ad8d46d8c0a778c1df9234d8084ee9b3 100644 (file)
@@ -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);
        }