]> granicus.if.org Git - php/commitdiff
MFH: invert the logics - FLAG_FCLOSE -> FLAG_NO_FCLOSE
authorAntony Dovgal <tony2001@php.net>
Wed, 23 Jul 2008 11:25:50 +0000 (11:25 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 23 Jul 2008 11:25:50 +0000 (11:25 +0000)
ext/bz2/bz2.c
ext/standard/dir.c
ext/standard/file.c
ext/standard/fsock.c
ext/standard/proc_open.c
ext/standard/streamsfuncs.c
ext/zip/zip_stream.c
main/php_streams.h
sapi/cli/php_cli.c

index 9bd15e69f55dab93b3a608c8df68b7ac9d5c60a3..b83d0b8f54754010a134dd19ae79a3fa0917defc 100644 (file)
@@ -247,7 +247,6 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
                        if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
                                bz_file = BZ2_bzdopen(fd, mode);
                        }
-                       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
                }
 
                /* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
@@ -261,7 +260,6 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
        if (bz_file) {
                retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC TSRMLS_CC);
                if (retstream) {
-                       retstream->flags |= PHP_STREAM_FLAG_FCLOSE;
                        return retstream;
                }
 
index bca2665080ffdac6cf718abd789812a363b0f9c7..c8f1ae731b1f475e3607d4d6fc045176fba2dffa 100644 (file)
@@ -220,6 +220,8 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
        if (dirp == NULL) {
                RETURN_FALSE;
        }
+
+       dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
                
        php_set_default_dir(dirp->rsrc_id TSRMLS_CC);
 
index 44c64d8cde54dae3efcd36d032529616b5dccc81..e16c432e7c085c426879c64a571425e5590051de 100644 (file)
@@ -861,8 +861,6 @@ PHP_NAMED_FUNCTION(php_if_tmpfile)
        stream = php_stream_fopen_tmpfile();
 
        if (stream) {
-               stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-
                php_stream_to_zval(stream, return_value);
        } else {
                RETURN_FALSE;
@@ -894,8 +892,6 @@ PHP_NAMED_FUNCTION(php_if_fopen)
                RETURN_FALSE;
        }
        
-       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-
        php_stream_to_zval(stream, return_value);
 
        if (zcontext) {
@@ -917,7 +913,7 @@ PHPAPI PHP_FUNCTION(fclose)
 
        PHP_STREAM_TO_ZVAL(stream, arg1);
        
-       if (!(stream->flags & PHP_STREAM_FLAG_FCLOSE)) {
+       if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a valid stream resource", stream->rsrc_id);
                RETURN_FALSE;
        }
index 7fd30f80c00f91d12b6cbed3402b51ef4c986fb3..31774f554cfa8624a583db30634388e3c2ec4fe7 100644 (file)
@@ -79,8 +79,6 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        stream = php_stream_xport_create(hostname, hostname_len, ENFORCE_SAFE_MODE | REPORT_ERRORS,
                        STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, hashkey, &tv, NULL, &errstr, &err);
 
-       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-
        if (port > 0) {
                efree(hostname);
        }
index f6f469a54a76e07f212768519d2c9ba81f2fb900..cd4c7b70e0e74ffe8adab983b37dd92677dec519 100644 (file)
@@ -969,7 +969,7 @@ PHP_FUNCTION(proc_open)
                                        zval *retfp;
 
                                        /* nasty hack; don't copy it */
-                                       stream->flags |= PHP_STREAM_FLAG_NO_SEEK | PHP_STREAM_FLAG_FCLOSE;
+                                       stream->flags |= PHP_STREAM_FLAG_NO_SEEK;
                                        
                                        MAKE_STD_ZVAL(retfp);
                                        php_stream_to_zval(stream, retfp);
index 465ad90e6611a82481a4ef53dd3746ed70bbfdef..7dade984ac81f0882a8c5d0e4351ea5ddbefa22e 100644 (file)
@@ -151,8 +151,6 @@ PHP_FUNCTION(stream_socket_client)
                RETURN_FALSE;
        }
        
-       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-       
        if (errstr) {
                efree(errstr);
        }
@@ -199,8 +197,6 @@ PHP_FUNCTION(stream_socket_server)
                        STREAM_XPORT_SERVER | flags,
                        NULL, NULL, context, &errstr, &err);
                        
-       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-
        if (stream == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : errstr);
        }
@@ -268,8 +264,6 @@ PHP_FUNCTION(stream_socket_accept)
                                &tv, &errstr
                                TSRMLS_CC) && clistream) {
                
-               clistream->flags |= PHP_STREAM_FLAG_FCLOSE;
-               
                if (peername) {
                        Z_TYPE_P(peername) = IS_STRING;
                }
index 1fda9c7eb87054e30266d28110e6b736f0feb673..1f305509ea26bf54c50540f17da6cf3cad743c74 100644 (file)
@@ -140,7 +140,6 @@ php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_D
        if (!stream) {
                return NULL;
        } else {
-               stream->flags |= PHP_STREAM_FLAG_FCLOSE;
                return stream;
        }
 
index bfb65ae5367dad5f3a6e1ed987434d41413b67e8..26e94f5ef6262ae90da2d19bd5638587af8fa7e9 100755 (executable)
@@ -183,7 +183,7 @@ struct _php_stream_wrapper  {
        
 #define PHP_STREAM_FLAG_IS_DIR                                         64
 
-#define PHP_STREAM_FLAG_FCLOSE                                         128
+#define PHP_STREAM_FLAG_NO_FCLOSE                                      128
 
 struct _php_stream  {
        php_stream_ops *ops;
index f8c84e8627180df0375bcdba396aef3b7b19e9b3..a076dfdcdc9b90588e045856cb771f4ffc79131b 100644 (file)
@@ -505,10 +505,6 @@ static void cli_register_file_handles(TSRMLS_D) /* {{{ */
                return;
        }
        
-       s_in->flags  |= PHP_STREAM_FLAG_FCLOSE;
-       s_out->flags |= PHP_STREAM_FLAG_FCLOSE;
-       s_err->flags |= PHP_STREAM_FLAG_FCLOSE;
-
 #if PHP_DEBUG
        /* do not close stdout and stderr */
        s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;