You should use PHP_DEBUG.
Isn't dup() a more robust fix?

Andi

At 12:59 PM 5/25/2004 +0000, Wez Furlong wrote:
wez             Tue May 25 08:59:15 2004 EDT

  Modified files:
    /php-src/main/streams       plain_wrapper.c
  Log:
  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.




http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.35&r2=1.36&ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.35 php-src/main/streams/plain_wrapper.c:1.36
--- php-src/main/streams/plain_wrapper.c:1.35 Tue Mar 16 18:23:16 2004
+++ php-src/main/streams/plain_wrapper.c Tue May 25 08:59:15 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/


-/* $Id: plain_wrapper.c,v 1.35 2004/03/16 23:23:16 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.36 2004/05/25 12:59:15 wez Exp $ */

#include "php.h"
#include "php_globals.h"
@@ -428,7 +428,16 @@
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 */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to