summaryrefslogtreecommitdiff
path: root/sapi/thttpd
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2003-07-01 05:29:17 +0000
committerSascha Schumann <sas@php.net>2003-07-01 05:29:17 +0000
commit6dcf9c22b5fe81227e8703676258fb8f195721bb (patch)
tree23cc46f22e09f6c6fa207c9aaf3711a3717e3ee9 /sapi/thttpd
parentfff7ef2f6cdd74e3f2a7c83ccbaf0df3d571e9a4 (diff)
downloadphp-git-6dcf9c22b5fe81227e8703676258fb8f195721bb.tar.gz
properly restart syscalls
Diffstat (limited to 'sapi/thttpd')
-rw-r--r--sapi/thttpd/thttpd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index b5912912a2..c6156c3b1d 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -50,6 +50,8 @@ typedef struct {
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 @@ static int sapi_thttpd_ub_write(const char *str, uint str_length TSRMLS_DC)
}
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 @@ static int do_writev(struct iovec *vec, int nvec, int len TSRMLS_DC)
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 @@ static int do_writev(struct iovec *vec, int nvec, int len TSRMLS_DC)
TG(hc)->bytes_sent += n;
- } else
+ } else {
n = 0;
+ }
if (n < len) {
int i;