summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2011-09-04 22:36:33 +0000
committerGustavo André dos Santos Lopes <cataphract@php.net>2011-09-04 22:36:33 +0000
commit08f78070a5a2b6354571443473f24983a0134386 (patch)
tree8ef3dc3554795c48b0d03764f7fdcff5bc16ced5
parentd7be9cf67584c3f5ceb83ee49f0ea7f7c2c66829 (diff)
downloadphp-git-08f78070a5a2b6354571443473f24983a0134386.tar.gz
- Fixed borked refactoring in r307437 (using SUCCESS/FAILURE return instead of
out parameter). - Fixed signature of php_stream_copy_to_stream_ex to return int in 5.4/trunk instead of size_t, as the function only returns SUCCESS/FAILURE.
-rw-r--r--main/streams/cast.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 38eb1a987c..d03cae3e29 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -271,15 +271,15 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
newstream = php_stream_fopen_tmpfile();
if (newstream) {
- size_t retval = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL);
+ size_t retcopy = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL);
- if (ret != SUCCESS) {
+ if (retcopy != SUCCESS) {
php_stream_close(newstream);
} else {
- int retcode = php_stream_cast(newstream, castas | flags, (void **)ret, show_err);
+ int retcast = php_stream_cast(newstream, castas | flags, (void **)ret, show_err);
- if (retcode == SUCCESS) {
- rewind(*(FILE**)retval);
+ if (retcast == SUCCESS) {
+ rewind(*(FILE**)ret);
}
/* do some specialized cleanup */
@@ -287,7 +287,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
php_stream_free(stream, PHP_STREAM_FREE_CLOSE_CASTED);
}
- return retcode;
+ /* TODO: we probably should be setting .stdiocast and .fclose_stdiocast or
+ * we may be leaking the FILE*. Needs investigation, though. */
+ return retcast;
}
}
}