diff options
author | Antony Dovgal <tony2001@php.net> | 2008-07-23 11:25:14 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2008-07-23 11:25:14 +0000 |
commit | 28a22396d4c12253f77c11095f37944a0dd661b9 (patch) | |
tree | 4a67877db12d22a70a443b40a74a74ee0e2efe9a | |
parent | 16ace1828e85f7cbe1179a29c88dad6d921e2a71 (diff) | |
download | php-git-28a22396d4c12253f77c11095f37944a0dd661b9.tar.gz |
MFH: invert the logics - FLAG_FCLOSE -> FLAG_NO_FCLOSE
-rw-r--r-- | ext/bz2/bz2.c | 2 | ||||
-rw-r--r-- | ext/standard/dir.c | 2 | ||||
-rw-r--r-- | ext/standard/file.c | 6 | ||||
-rw-r--r-- | ext/standard/fsock.c | 2 | ||||
-rw-r--r-- | ext/standard/proc_open.c | 2 | ||||
-rw-r--r-- | ext/standard/streamsfuncs.c | 6 | ||||
-rw-r--r-- | ext/zip/zip_stream.c | 1 | ||||
-rwxr-xr-x | main/php_streams.h | 2 | ||||
-rw-r--r-- | sapi/cli/php_cli.c | 4 |
9 files changed, 5 insertions, 22 deletions
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index e4cbb1902f..d051b19dbf 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -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; } diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 537b8ef557..63292a853d 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -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); diff --git a/ext/standard/file.c b/ext/standard/file.c index 6bc27a8d82..c8178e0581 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -856,8 +856,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; @@ -888,8 +886,6 @@ PHP_NAMED_FUNCTION(php_if_fopen) RETURN_FALSE; } - stream->flags |= PHP_STREAM_FLAG_FCLOSE; - php_stream_to_zval(stream, return_value); } /* }}} */ @@ -907,7 +903,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; } diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 7fd30f80c0..31774f554c 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -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); } diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index f6f469a54a..cd4c7b70e0 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -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); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 195e364157..459c8389ed 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -155,8 +155,6 @@ PHP_FUNCTION(stream_socket_client) RETURN_FALSE; } - stream->flags |= PHP_STREAM_FLAG_FCLOSE; - if (errstr) { efree(errstr); } @@ -204,8 +202,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); } @@ -271,8 +267,6 @@ PHP_FUNCTION(stream_socket_accept) &tv, &errstr TSRMLS_CC) && clistream) { - clistream->flags |= PHP_STREAM_FLAG_FCLOSE; - if (peername) { ZVAL_STRINGL(zpeername, peername, peername_len, 0); } diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 1fda9c7eb8..1f305509ea 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -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; } diff --git a/main/php_streams.h b/main/php_streams.h index 6268d1b971..e7effd1f22 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -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; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 6f6efb6dc5..68e2af3589 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -502,10 +502,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; |