cvs: php4 /main streams.c
| From: | Wez Furlong | Date: | Sat, 16 Mar 2002 11:24:12 +0000 |
| Subject: | cvs: php4 /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10222@lists.php.net to get a copy of this message | ||
wez Sat Mar 16 06:24:12 2002 EDT
Modified files:
/php4/main streams.c
Log:
Hopefully fix probs with apache.
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.17 php4/main/streams.c:1.18
--- php4/main/streams.c:1.17 Fri Mar 15 22:50:17 2002
+++ php4/main/streams.c Sat Mar 16 06:24:12 2002
@@ -67,8 +67,6 @@
{
int ret = 1;
- php_stream_flush(stream);
-
if (stream->wrapper && stream->wrapper->destroy) {
stream->wrapper->destroy(stream);
}
@@ -87,6 +85,7 @@
php_stream_flush(stream);
ret = stream->ops->close(stream);
+ stream->abstract = NULL;
/* tidy up any FILE* that might have been fdopened */
if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FDOPEN && stream->stdiocast) {
@@ -448,6 +447,8 @@
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
+ assert(data != NULL);
+
#if HAVE_FLUSHIO
if (data->last_op == 'r') {
fseek(data->file, 0, SEEK_CUR);
@@ -462,6 +463,8 @@
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
+ assert(data != NULL);
+
if (buf == NULL && count == 0) {
/* check for EOF condition */
if (feof(data->file)) {
@@ -484,6 +487,8 @@
int ret;
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
+ assert(data != NULL);
+
if (data->is_pipe) {
ret = pclose(data->file);
} else {
@@ -497,18 +502,27 @@
static int php_stdiop_flush(php_stream *stream)
{
- return fflush(((php_stdio_stream_data*)stream->abstract)->file);
+ php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
+
+ assert(data != NULL);
+
+ return fflush(data->file);
}
static int php_stdiop_seek(php_stream *stream, off_t offset, int whence)
{
- return fseek(((php_stdio_stream_data*)stream->abstract)->file, offset, whence);
+ php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
+
+ assert(data != NULL);
+
+ return fseek(data->file, offset, whence);
}
static char *php_stdiop_gets(php_stream *stream, char *buf, size_t size)
{
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
+ assert(data != NULL);
#if HAVE_FLUSHIO
if (data->last_op == 'w') {
fseek(data->file, 0, SEEK_CUR);
@@ -523,6 +537,8 @@
int fd;
php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
+ assert(data != NULL);
+
switch (castas) {
case PHP_STREAM_AS_STDIO:
if (ret) {