summaryrefslogtreecommitdiff
path: root/main/streams.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/streams.c')
-rwxr-xr-xmain/streams.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/main/streams.c b/main/streams.c
index 67e961540b..d746e35996 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -1332,6 +1332,15 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode STREAMS_DC
struct stat sb;
self->is_pipe = (fstat(self->fd, &sb) == 0 && S_ISFIFO(sb.st_mode)) ? 1 : 0;
}
+#elif defined(PHP_WIN32)
+ {
+ long handle = _get_osfhandle(self->fd);
+ DWORD in_buf_size, out_buf_size;
+
+ if (handle != 0xFFFFFFFF) {
+ self->is_pipe = GetNamedPipeInfo((HANDLE)handle, NULL, &out_buf_size, &in_buf_size, NULL);
+ }
+ }
#endif
stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);
@@ -1365,6 +1374,15 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STRE
struct stat sb;
self->is_pipe = (fstat(self->fd, &sb) == 0 && S_ISFIFO(sb.st_mode)) ? 1 : 0;
}
+#elif defined(PHP_WIN32)
+ {
+ long handle = _get_osfhandle(self->fd);
+ DWORD in_buf_size, out_buf_size;
+
+ if (handle != 0xFFFFFFFF) {
+ self->is_pipe = GetNamedPipeInfo((HANDLE)handle, NULL, &out_buf_size, &in_buf_size, NULL);
+ }
+ }
#endif
stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode);