]> granicus.if.org Git - php/commitdiff
Only fetch globals if it's necessary (which it usually won't be)
authorZeev Suraski <zeev@php.net>
Thu, 25 May 2000 14:43:30 +0000 (14:43 +0000)
committerZeev Suraski <zeev@php.net>
Thu, 25 May 2000 14:43:30 +0000 (14:43 +0000)
sapi/cgi/cgi_main.c

index d36a8626638d3d8f57486ba0758d6b5a5c84a134..b1a1df722f40d1fb3ae2a93eec90995116989e3e 100644 (file)
@@ -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();