]> granicus.if.org Git - php/commitdiff
fix #28803 (enabled debug causes bailout errors with CLI on AIX
authorAntony Dovgal <tony2001@php.net>
Tue, 22 Mar 2005 15:08:52 +0000 (15:08 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 22 Mar 2005 15:08:52 +0000 (15:08 +0000)
because of fflush() called on already closed filedescriptor)

sapi/cli/php_cli.c

index aab039a8f660dfe4c8ee4b7011d165a42c7c90c9..33343137240d07c13441aadb7a0fc2b8e002752c 100644 (file)
@@ -220,7 +220,10 @@ static int sapi_cli_ub_write(const char *str, uint str_length TSRMLS_DC)
 
 static void sapi_cli_flush(void *server_context)
 {
-       if (fflush(stdout)==EOF) {
+       /* Ignore EBADF here, it's caused by the fact that STDIN/STDOUT/STDERR streams
+        * are/could be closed before fflush() is called.
+        */
+       if (fflush(stdout)==EOF && errno!=EBADF) {
 #ifndef PHP_CLI_WIN32_NO_CONSOLE
                php_handle_aborted_connection();
 #endif