Correctly check return of rename(2)
authorVolker Lendecke <vl@samba.org>
Mon, 25 Feb 2008 12:00:24 +0000 (13:00 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 25 Feb 2008 12:05:18 +0000 (13:05 +0100)
Bug 5279 -- Thanks to Max Matveev

source/modules/vfs_default.c

index cf135dfd0302c68ff26d2306e06a65163b3dada4..31ebb6352a179d5631c588aab69b9714e068d7f7 100644 (file)
@@ -468,7 +468,7 @@ static int vfswrap_rename(vfs_handle_struct *handle,  const char *oldname, const
 
        START_PROFILE(syscall_rename);
        result = rename(oldname, newname);
-       if (errno == EXDEV) {
+       if ((result == -1) && (errno == EXDEV)) {
                /* Rename across filesystems needed. */
                result = copy_reg(oldname, newname);
        }