diff options
| author | Marcus Boerger <helly@php.net> | 2005-12-14 00:06:09 +0000 |
|---|---|---|
| committer | Marcus Boerger <helly@php.net> | 2005-12-14 00:06:09 +0000 |
| commit | 71c7cdb7d9867ac68ad1a211b4629cd0f7cf2923 (patch) | |
| tree | 1b06a99966b798e0fb77680c98b3d7284ae6aecf | |
| parent | f7aec44aee525f796c21e6d538bf28e7ff33b089 (diff) | |
| download | php-git-71c7cdb7d9867ac68ad1a211b4629cd0f7cf2923.tar.gz | |
- Fix temp/memory stream modes
| -rw-r--r-- | main/streams/memory.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/main/streams/memory.c b/main/streams/memory.c index af050665b1..28ad86498f 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -221,7 +221,7 @@ PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC TSRMLS_DC) self->smax = -1; self->mode = mode; - stream = php_stream_alloc(&php_stream_memory_ops, self, 0, "r+b"); + stream = php_stream_alloc(&php_stream_memory_ops, self, 0, mode & TEMP_STREAM_READONLY ? "r+b" : "w+b"); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; return stream; } @@ -441,7 +441,7 @@ PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STR self = ecalloc(1, sizeof(*self)); self->smax = max_memory_usage; self->mode = mode; - stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "r+b"); + stream = php_stream_alloc(&php_stream_temp_ops, self, 0, mode & TEMP_STREAM_READONLY ? "r+b" : "w+b"); stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; self->innerstream = php_stream_memory_create(mode); @@ -456,7 +456,7 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char php_stream *stream; php_stream_temp_data *ms; - if ((stream = php_stream_temp_create_rel(mode & ~TEMP_STREAM_READONLY, max_memory_usage)) != NULL) { + if ((stream = php_stream_temp_create_rel(mode, max_memory_usage)) != NULL) { if (length) { assert(buf != NULL); php_stream_temp_write(stream, buf, length TSRMLS_CC); |
