Skip to content

Remove useless duplicated call to php_stream_parse_fopen_modes #12059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions main/streams/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {

Expand Down