1
0
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:
Niels Dossche
2023-02-11 16:25:14 +01:00
committed by GitHub
parent 0d56a5b591
commit e787d6c9e6
+7
View File
@@ -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;