summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 52c5e1d1e4..919382aa3c 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
}
}