aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2014-08-27 20:51:01 +0400
committerValentin Bartenev <vbart@nginx.com>2014-08-27 20:51:01 +0400
commit840b347bb24bea09f9824891239929cdce84e47b (patch)
tree5d15de6ef6f0da2f44d6a5dd646330453a12ca78 /src/os/unix
parent70995077ad9866b6c85d7fbb86d31bc5445bc821 (diff)
downloadnginx-840b347bb24bea09f9824891239929cdce84e47b.tar.gz
nginx-840b347bb24bea09f9824891239929cdce84e47b.zip
Fixed counting of sent bytes in the send chain functions on EINTR.
Previously, a value of the "send" variable wasn't properly adjusted in a rare case when syscall was interrupted by a signal. As a result, these functions could send less data than the limit allows.
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_darwin_sendfile_chain.c1
-rw-r--r--src/os/unix/ngx_freebsd_sendfile_chain.c1
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c1
-rw-r--r--src/os/unix/ngx_solaris_sendfilev_chain.c1
-rw-r--r--src/os/unix/ngx_writev_chain.c1
5 files changed, 5 insertions, 0 deletions
diff --git a/src/os/unix/ngx_darwin_sendfile_chain.c b/src/os/unix/ngx_darwin_sendfile_chain.c
index dd574e5ac..8485f9749 100644
--- a/src/os/unix/ngx_darwin_sendfile_chain.c
+++ b/src/os/unix/ngx_darwin_sendfile_chain.c
@@ -308,6 +308,7 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent);
if (eintr) {
+ send = prev_send + sent;
continue;
}
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
index f5d0f3a8a..88eacc2d1 100644
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -378,6 +378,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
}
if (eintr) {
+ send = prev_send + sent;
continue;
}
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index 1060852a0..60867c51e 100644
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -316,6 +316,7 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent);
if (eintr) {
+ send = prev_send;
continue;
}
diff --git a/src/os/unix/ngx_solaris_sendfilev_chain.c b/src/os/unix/ngx_solaris_sendfilev_chain.c
index ba328c810..1b71f1dd8 100644
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c
+++ b/src/os/unix/ngx_solaris_sendfilev_chain.c
@@ -200,6 +200,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent);
if (eintr) {
+ send = prev_send + sent;
continue;
}
diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c
index 95af2da7a..c7b6ebf7c 100644
--- a/src/os/unix/ngx_writev_chain.c
+++ b/src/os/unix/ngx_writev_chain.c
@@ -134,6 +134,7 @@ ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent);
if (eintr) {
+ send = prev_send;
continue;
}