diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 52c5e1d1e4c..919382aa3c6 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -208,6 +208,12 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha stream->flags |= PHP_STREAM_FLAG_NO_SEEK; } else { stream->position = lseek(self->fd, 0, SEEK_CUR); +#ifdef ESPIPE + if (stream->position == (off_t)-1 && errno == ESPIPE) { + stream->position = 0; + stream->is_pipe = 1; + } +#endif } }