summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-05-31 00:32:45 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-05-31 00:32:45 +0000
commit32a0044a21c71ef58fba4b318e7068c414ea50e0 (patch)
tree50dca937cc1653f7c29237fa8a8e1b1baa894877
parent3240dce99cc91b40db65e616607ac5c0d6ebe7ab (diff)
downloadphp-git-32a0044a21c71ef58fba4b318e7068c414ea50e0.tar.gz
Fixed bug #23913 (make rename() work across partitions on *nix)
-rw-r--r--ext/standard/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f31c3718de..e552cb7758 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -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;
}