aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_linux_sendfile_chain.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2014-11-19 21:18:13 +0300
committerValentin Bartenev <vbart@nginx.com>2014-11-19 21:18:13 +0300
commit1276d8483e8ae08d518ae0fe9c10fa9e90fe54fe (patch)
tree3269d2b4da32ceaac31326d59cc5710ae59a59c4 /src/os/unix/ngx_linux_sendfile_chain.c
parenta301e1a7064b0d83a2f456a305f07962ad4f0773 (diff)
downloadnginx-1276d8483e8ae08d518ae0fe9c10fa9e90fe54fe.tar.gz
nginx-1276d8483e8ae08d518ae0fe9c10fa9e90fe54fe.zip
Fixed type of sendfile() return value on Linux.
There was no real problem since the amount of bytes can be sent is limited by NGX_SENDFILE_MAXSIZE to less than 2G. But that can be changed in the future
Diffstat (limited to 'src/os/unix/ngx_linux_sendfile_chain.c')
-rw-r--r--src/os/unix/ngx_linux_sendfile_chain.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c
index f1fcc748a..d696438be 100644
--- a/src/os/unix/ngx_linux_sendfile_chain.c
+++ b/src/os/unix/ngx_linux_sendfile_chain.c
@@ -30,7 +30,7 @@
ngx_chain_t *
ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
{
- int rc, tcp_nodelay;
+ int tcp_nodelay;
off_t send, prev_send, sent;
size_t file_size;
ssize_t n;
@@ -170,9 +170,9 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
"sendfile: @%O %uz", file->file_pos, file_size);
- rc = sendfile(c->fd, file->file->fd, &offset, file_size);
+ n = sendfile(c->fd, file->file->fd, &offset, file_size);
- if (rc == -1) {
+ if (n == -1) {
err = ngx_errno;
switch (err) {
@@ -193,11 +193,11 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
"sendfile() is not ready");
}
- sent = rc > 0 ? rc : 0;
+ sent = n > 0 ? n : 0;
ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
- "sendfile: %d, @%O %O:%uz",
- rc, file->file_pos, sent, file_size);
+ "sendfile: %z, @%O %O:%uz",
+ n, file->file_pos, sent, file_size);
} else {
n = ngx_writev(c, &header);