From: Thies C. Arntzen Date: Thu, 25 May 2000 07:01:34 +0000 (+0000) Subject: @- ignore_user_abort() & friends should now work in CGI mode as well. X-Git-Tag: PRE_EIGHT_BYTE_ALLOC_PATCH~258 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e319b5f6a52cabae648681f178eafde3229a266d;p=php @- ignore_user_abort() & friends should now work in CGI mode as well. @ (Patch by daniel.braun@ercom.fr) --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 1be7665563..d36a862663 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -86,13 +86,31 @@ extern int ap_php_optind; static int sapi_cgibin_ub_write(const char *str, uint str_length) { - return fwrite(str, 1, str_length, stdout); + int ret; + PLS_FETCH(); + + ret = fwrite(str, 1, str_length, stdout); + if (ret != str_length) { + PG(connection_status) = PHP_CONNECTION_ABORTED; + if (!PG(ignore_user_abort)) { + zend_bailout(); + } + } + + return ret; } static void sapi_cgibin_flush(void *server_context) { - fflush(stdout); + PLS_FETCH(); + + if (fflush(stdout)) { + PG(connection_status) = PHP_CONNECTION_ABORTED; + if (!PG(ignore_user_abort)) { + zend_bailout(); + } + } }