cvs: php4 /main/streams streams.c
| From: | Wez Furlong | Date: | Wed, 19 Mar 2003 00:17:15 +0000 |
| Subject: | cvs: php4 /main/streams streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-19683@lists.php.net to get a copy of this message | ||
wez Tue Mar 18 19:17:15 2003 EDT
Modified files:
/php4/main/streams streams.c
Log:
Sanity check for when a stream is requested to be persistent but the wrapper
does not respect the flag.
Index: php4/main/streams/streams.c
diff -u php4/main/streams/streams.c:1.12 php4/main/streams/streams.c:1.13
--- php4/main/streams/streams.c:1.12 Tue Mar 18 17:26:02 2003
+++ php4/main/streams/streams.c Tue Mar 18 19:17:15 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.12 2003/03/18 22:26:02 wez Exp $ */
+/* $Id: streams.c,v 1.13 2003/03/19 00:17:15 wez Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -1461,6 +1461,15 @@
stream = wrapper->wops->stream_opener(wrapper,
path_to_open, mode, options ^ REPORT_ERRORS,
opened_path, context STREAMS_REL_CC TSRMLS_CC);
+
+ /* if the caller asked for a persistent stream but the wrapper did not
+ * return one, force an error here */
+ if (stream && (options & STREAM_OPEN_PERSISTENT) &&
!stream->is_persistent) {
+ php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC,
+ "wrapper does not support persistent streams");
+ php_stream_close(stream);
+ stream = NULL;
+ }
if (stream) {
stream->wrapper = wrapper;