Index: file.c =================================================================== RCS file: /repository/php-src/ext/standard/file.c,v retrieving revision 1.279.2.62 diff -u -r1.279.2.62 file.c --- file.c 24 Sep 2004 13:07:18 -0000 1.279.2.62 +++ file.c 24 Oct 2004 11:57:01 -0000 @@ -1914,9 +1914,20 @@ 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; + struct stat sb; + if (php_copy_file(old_name, new_name TSRMLS_CC) == SUCCESS) { + if (VCWD_STAT(old_name, &sb) == 0) { + if (VCWD_CHMOD(new_name, sb.st_mode)) { + php_error_docref2(NULL TSRMLS_CC, old_name, new_name, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + if (VCWD_CHOWN(new_name, sb.st_uid, sb.st_gid)) { + php_error_docref2(NULL TSRMLS_CC, old_name, new_name, E_WARNING, "%s", strerror(errno)); + RETURN_FALSE; + } + VCWD_UNLINK(old_name); + RETURN_TRUE; + } } } #endif