From: Wez Furlong Date: Fri, 23 May 2003 15:27:09 +0000 (+0000) Subject: Avoid greedy reads on FIFOs X-Git-Tag: php-4.3.2RC4~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bdcd417ad6022ce079bed02b56b7dcbe2b50e973;p=php Avoid greedy reads on FIFOs --- diff --git a/main/streams.c b/main/streams.c index 62b77b79b4..47b007a170 100755 --- a/main/streams.c +++ b/main/streams.c @@ -1397,7 +1397,7 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STRE if (stream) { if (self->is_pipe) { - stream->flags |= PHP_STREAM_FLAG_NO_SEEK; + stream->flags |= PHP_STREAM_FLAG_NO_SEEK | PHP_STREAM_FLAG_AVOID_BLOCKING; } else { stream->position = ftell(file); } @@ -1419,7 +1419,7 @@ PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STRE self->temp_file_name = NULL; stream = php_stream_alloc_rel(&php_stream_stdio_ops, self, 0, mode); - stream->flags |= PHP_STREAM_FLAG_NO_SEEK; + stream->flags |= PHP_STREAM_FLAG_NO_SEEK | PHP_STREAM_FLAG_AVOID_BLOCKING; return stream; } @@ -2041,7 +2041,7 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha if (stream) { if (self->is_pipe) { - stream->flags |= PHP_STREAM_FLAG_NO_SEEK; + stream->flags |= PHP_STREAM_FLAG_NO_SEEK | PHP_STREAM_FLAG_AVOID_BLOCKING; } else { stream->position = lseek(self->fd, 0, SEEK_CUR); }