tony2001 Wed Oct 27 07:58:50 2004 EDT Modified files: /php-src/main/streams plain_wrapper.c Log: fix bug #30388 (rename across filesystems loses ownership and permission info) http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.40&r2=1.41&ty=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.40 php-src/main/streams/plain_wrapper.c:1.41 --- php-src/main/streams/plain_wrapper.c:1.40 Sat Jul 31 06:09:25 2004 +++ php-src/main/streams/plain_wrapper.c Wed Oct 27 07:58:49 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.40 2004/07/31 10:09:25 wez Exp $ */ +/* $Id: plain_wrapper.c,v 1.41 2004/10/27 11:58:49 tony2001 Exp $ */ #include "php.h" #include "php_globals.h" @@ -1021,10 +1021,33 @@ 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)) { + if (errno == EPERM) { + php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + VCWD_UNLINK(url_from); + return 1; + } + 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)) { + if (errno == EPERM) { + php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, "%s", strerror(errno)); + VCWD_UNLINK(url_from); + return 1; + } + 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));
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php