From 76dd2cf200b9cf6a6967e7d459ac27e192faf7ac Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 27 Aug 2023 16:50:25 +0200 Subject: [PATCH] Remove useless duplicated call to php_stream_parse_fopen_modes --- main/streams/streams.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/streams/streams.c b/main/streams/streams.c index 06589e649c2e..bc0b551b5208 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1602,12 +1602,10 @@ PHPAPI zend_result _php_stream_copy_to_stream_ex(php_stream *src, php_stream *de * read buffer is empty: we can use copy_file_range() */ int src_fd, dest_fd, dest_open_flags = 0; - /* get dest open flags to check if the stream is open in append mode */ - php_stream_parse_fopen_modes(dest->mode, &dest_open_flags); - /* copy_file_range does not work with O_APPEND */ if (php_stream_cast(src, PHP_STREAM_AS_FD, (void*)&src_fd, 0) == SUCCESS && php_stream_cast(dest, PHP_STREAM_AS_FD, (void*)&dest_fd, 0) == SUCCESS && + /* get dest open flags to check if the stream is open in append mode */ php_stream_parse_fopen_modes(dest->mode, &dest_open_flags) == SUCCESS && !(dest_open_flags & O_APPEND)) {