]> granicus.if.org Git - php/commitdiff
invert the logics - FLAG_FCLOSE -> FLAG_NO_FCLOSE
authorAntony Dovgal <tony2001@php.net>
Wed, 23 Jul 2008 11:24:35 +0000 (11:24 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 23 Jul 2008 11:24:35 +0000 (11:24 +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 f1221958fb43ef17ccce9428182c89845ac12561..32b2f01d5dcf2d3d79c0e92a872a96784928a36c 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 0b1caa08a62121de5a01c68ca875d6aafedddc67..7d33aa264eaeb61c9898d58c0fb7073a00f27cc1 100644 (file)
@@ -230,6 +230,8 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
        if (dirp == NULL) {
                goto opendir_cleanup;
        }
+
+       dirp->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
                
        php_set_default_dir(dirp->rsrc_id TSRMLS_CC);
 
index b7e807b16314d51739b5096104ba1e2c2d3e642a..4a7bde1ba3c471ebb70beda092e2faeedb3ae921 100644 (file)
@@ -965,8 +965,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;
@@ -1001,8 +999,6 @@ PHP_NAMED_FUNCTION(php_if_fopen)
                RETURN_FALSE;
        }
        
-       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-
        php_stream_to_zval(stream, return_value);
 }
 /* }}} */
@@ -1020,7 +1016,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 84ed477a0e2162293d26ac7732d52ed5229158ff..1dc2215666c5999ee21ba8f3669c07d926fde153 100644 (file)
@@ -79,8 +79,6 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        stream = php_stream_xport_create(hostname, hostname_len, 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 0ae8d9c21152136e3a92536a79ff0db0a9206844..67dd956fa1b965bbf3074285c16b848d9f0adbf1 100644 (file)
@@ -971,7 +971,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;
 
                                        if (UG(unicode) && !binary_pipes) {
                                                if (write_stream) {
index 521ed3d024ad86dfcf5e8e8f2a082e973c2c88e6..3d68bd5a39e21135b6e49a0a263de39e6b0522aa 100644 (file)
@@ -156,8 +156,6 @@ PHP_FUNCTION(stream_socket_client)
                RETURN_FALSE;
        }
        
-       stream->flags |= PHP_STREAM_FLAG_FCLOSE;
-       
        if (errstr) {
                efree(errstr);
        }
@@ -205,8 +203,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);
        }
@@ -273,8 +269,6 @@ PHP_FUNCTION(stream_socket_accept)
                                &tv, &errstr
                                TSRMLS_CC) && clistream) {
                
-               clistream->flags |= PHP_STREAM_FLAG_FCLOSE;
-               
                if (peername) {
                        ZVAL_RT_STRINGL(zpeername, peername, peername_len, ZSTR_AUTOFREE);
                }
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 fcffeafeddbd6553806d0a3e8c44a82f048377e3..068b47e7c8312211b34866f03832d492e236aef4 100755 (executable)
@@ -191,7 +191,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 ccac5166ec02b6420dc3b63ed639dcc70817f8b3..969d7adcc7bcfddb5c61533a0fe7435eb9373c06 100644 (file)
@@ -517,10 +517,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;