cvs: php4 /sapi/cgi/ cgi_main.c

[email protected] ("Thies C. Arntzen")
Newsgroups php.version4
Message-ID <cvsthies959238095@cvsserver>
thies		Thu May 25 09:01:35 2000 EDT

  Modified files:
    /php4/sapi/cgi	cgi_main.c 
  Log:
  @- ignore_user_abort() & friends should now work in CGI mode as well.
  @  (Patch by [email protected])
  
  
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.44 php4/sapi/cgi/cgi_main.c:1.45
--- php4/sapi/cgi/cgi_main.c:1.44	Tue May 23 00:49:18 2000
+++ php4/sapi/cgi/cgi_main.c	Thu May 25 09:01:34 2000
@@ -86,13 +86,31 @@
 
 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();
+		}
+	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.