summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-05-25 14:43:30 +0000
committerZeev Suraski <zeev@php.net>2000-05-25 14:43:30 +0000
commit1895a097496a64306da8dcd4aa519a3f6a827af4 (patch)
tree179ca882e3f9ba10ef0fa4f1cda8843d5f44a1d0 /sapi
parentcecfdbe71ecf6a994b82f876599bdda158432579 (diff)
downloadphp-git-1895a097496a64306da8dcd4aa519a3f6a827af4.tar.gz
Only fetch globals if it's necessary (which it usually won't be)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index d36a862663..b1a1df722f 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -87,10 +87,11 @@ extern int ap_php_optind;
static int sapi_cgibin_ub_write(const char *str, uint str_length)
{
int ret;
- PLS_FETCH();
ret = fwrite(str, 1, str_length, stdout);
if (ret != str_length) {
+ PLS_FETCH();
+
PG(connection_status) = PHP_CONNECTION_ABORTED;
if (!PG(ignore_user_abort)) {
zend_bailout();
@@ -103,9 +104,9 @@ static int sapi_cgibin_ub_write(const char *str, uint str_length)
static void sapi_cgibin_flush(void *server_context)
{
- PLS_FETCH();
+ if (fflush(stdout)==EOF) {
+ PLS_FETCH();
- if (fflush(stdout)) {
PG(connection_status) = PHP_CONNECTION_ABORTED;
if (!PG(ignore_user_abort)) {
zend_bailout();