]> granicus.if.org Git - php/commitdiff
Avoid greedy reads on FIFOs
authorWez Furlong <wez@php.net>
Fri, 23 May 2003 15:27:09 +0000 (15:27 +0000)
committerWez Furlong <wez@php.net>
Fri, 23 May 2003 15:27:09 +0000 (15:27 +0000)
main/streams.c

index 62b77b79b46446d425e6f4bf0ec3c9dc0c153ca2..47b007a17081c5f54a7a7a759e1255e893c771b5 100755 (executable)
@@ -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);
                }