Index: plain_wrapper.c =================================================================== RCS file: /repository/php-src/main/streams/plain_wrapper.c,v retrieving revision 1.40 diff -u -r1.40 plain_wrapper.c --- plain_wrapper.c 31 Jul 2004 10:09:25 -0000 1.40 +++ plain_wrapper.c 23 Oct 2004 13:00:01 -0000 @@ -1021,10 +1025,23 @@ if (ret == -1) { #ifdef EXDEV if (errno == EXDEV) { + struct stat sb; if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) { - VCWD_UNLINK(url_from); - return 1; + if (VCWD_STAT(url_from, &sb) == 0) { + if (VCWD_CHMOD(url_to, sb.st_mode)) { + php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + return 0; + } + if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) { + php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + return 0; + } + VCWD_UNLINK(url_from); + return 1; + } } + php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + return 0; } #endif php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno));