sas             Tue Jul  1 01:29:04 2003 EDT

  Modified files:              (Branch: PHP_4)
    /php-src/sapi/thttpd        thttpd.c 
  Log:
  properly restart syscalls
  
Index: php-src/sapi/thttpd/thttpd.c
diff -u php-src/sapi/thttpd/thttpd.c:1.77.2.13.2.1 
php-src/sapi/thttpd/thttpd.c:1.77.2.13.2.2
--- php-src/sapi/thttpd/thttpd.c:1.77.2.13.2.1  Fri Jun 27 14:41:03 2003
+++ php-src/sapi/thttpd/thttpd.c        Tue Jul  1 01:29:04 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: thttpd.c,v 1.77.2.13.2.1 2003/06/27 18:41:03 sas Exp $ */
+/* $Id: thttpd.c,v 1.77.2.13.2.2 2003/07/01 05:29:04 sas Exp $ */
 
 #include "php.h"
 #include "SAPI.h"
@@ -50,6 +50,8 @@
        int seen_cn;
 } php_thttpd_globals;
 
+#define PHP_SYS_CALL(x) do { x } while (n == -1 && errno == EINTR)
+
 #ifdef PREMIUM_THTTPD
 # define do_keep_alive persistent
 #endif
@@ -73,7 +75,7 @@
        }
        
        while (str_length > 0) {
-               n = send(TG(hc)->conn_fd, str, str_length, 0);
+               PHP_SYS_CALL(n = send(TG(hc)->conn_fd, str, str_length, 0););
 
                if (n == -1) {
                        if (errno == EAGAIN) {
@@ -108,7 +110,7 @@
        assert(nvec <= IOV_MAX);
 
        if (TG(sbuf).c == 0) {
-               n = writev(TG(hc)->conn_fd, vec, nvec);
+               PHP_SYS_CALL(n = writev(TG(hc)->conn_fd, vec, nvec););
 
                if (n == -1) {
                        if (errno == EAGAIN) {
@@ -120,8 +122,9 @@
 
 
                TG(hc)->bytes_sent += n;
-       } else
+       } else {
                n = 0;
+       }
 
        if (n < len) {
                int i;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to