]> granicus.if.org Git - php/commitdiff
@- ignore_user_abort() & friends should now work in CGI mode as well.
authorThies C. Arntzen <thies@php.net>
Thu, 25 May 2000 07:01:34 +0000 (07:01 +0000)
committerThies C. Arntzen <thies@php.net>
Thu, 25 May 2000 07:01:34 +0000 (07:01 +0000)
@  (Patch by daniel.braun@ercom.fr)

sapi/cgi/cgi_main.c

index 1be7665563f31b7278b7d52947d6930ea29d5f31..d36a8626638d3d8f57486ba0758d6b5a5c84a134 100644 (file)
@@ -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();
+               }
+       }
 }