mirror of
https://github.com/php/php-src.git
synced 2026-04-29 19:23:22 +02:00
Fix GH-10548: copy() fails on cifs mounts because of incorrect length (cfr_max) specified in streams.c:1584 copy_file_range() (#10551)
On some filesystems, the copy operation fails if we specify a size larger than the file size in certain circumstances and configurations. In those cases EIO will be returned as errno and we will therefore fall back to other methods.
This commit is contained in:
@@ -1614,6 +1614,13 @@ PHPAPI zend_result _php_stream_copy_to_stream_ex(php_stream *src, php_stream *de
|
||||
/* not implemented by this Linux kernel */
|
||||
break;
|
||||
|
||||
case EIO:
|
||||
/* Some filesystems will cause failures if the max length is greater than the file length
|
||||
* in certain circumstances and configuration. In those cases the errno is EIO and we will
|
||||
* fall back to other methods. We cannot use stat to determine the file length upfront because
|
||||
* that is prone to races and outdated caching. */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* unexpected I/O error - give up, no fallback */
|
||||
*len = haveread;
|
||||
|
||||
Reference in New Issue
Block a user