]> granicus.if.org Git - php/commitdiff
Fixed bug #23913 (make rename() work across partitions on *nix)
authorIlia Alshanetsky <iliaa@php.net>
Sat, 31 May 2003 00:32:45 +0000 (00:32 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 31 May 2003 00:32:45 +0000 (00:32 +0000)
ext/standard/file.c

index f31c3718ded7c5877a915ef84a042b1ff7118524..e552cb7758574a60b2512b9dbbe51ac96d506e8b 100644 (file)
@@ -1391,6 +1391,14 @@ PHP_FUNCTION(rename)
        ret = VCWD_RENAME(old_name, new_name);
 
        if (ret == -1) {
+#ifdef EXDEV
+               if (errno == EXDEV) {
+                       if (php_copy_file(old_name, new_name TSRMLS_CC) == SUCCESS) {
+                               VCWD_UNLINK(old_name);
+                               RETURN_TRUE;
+                       }
+               }
+#endif 
                php_error_docref2(NULL TSRMLS_CC, old_name, new_name, E_WARNING, "%s", strerror(errno));
                RETURN_FALSE;
        }