summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-05-25 12:59:15 +0000
committerWez Furlong <wez@php.net>2004-05-25 12:59:15 +0000
commitc6dff79138f5e399ee4de1d9f22d02f41b9d5c0c (patch)
treeae01186cf37b01ac542057a7d98f8f8cb3b37bef /main/streams/plain_wrapper.c
parent32956a25bf1bf32034554e35cf188d96f468c5e1 (diff)
downloadphp-git-c6dff79138f5e399ee4de1d9f22d02f41b9d5c0c.tar.gz
In debug mode, under CLI don't close stderr.
This is so that we can see any error reports. # for extra paranoia, could limit this check to happen only after the script is # finished running.
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index b1b27f6049..9a4027ec9a 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -428,7 +428,16 @@ static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC)
data->file = NULL;
}
} else if (data->fd != -1) {
+#ifdef DEBUG
+ if (data->fd == 2 && strcmp(sapi_module.name, "cli")) {
+ /* don't close stderr in CLI in DEBUG mode, as we want to see any leaks */
+ ret = 0;
+ } else {
+ ret = close(data->fd);
+ }
+#else
ret = close(data->fd);
+#endif
data->fd = -1;
} else {
return 0; /* everything should be closed already -> success */