summaryrefslogtreecommitdiff
path: root/source3/lib/recvfile.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-01-07 21:45:49 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-01-07 21:45:49 +0100
commit66fa21ef73464188f5cb20e5fc96c5aa35d434b6 (patch)
treefa54883af4c07ac6886222aa751e97efe2753f8c /source3/lib/recvfile.c
parentea1ff069a53a53b0251179dca30ce52dd8b56a23 (diff)
parent45c67ff244a4a40b8fd099b3cbdc135a527c30eb (diff)
downloadsamba-66fa21ef73464188f5cb20e5fc96c5aa35d434b6.tar.gz
samba-66fa21ef73464188f5cb20e5fc96c5aa35d434b6.tar.bz2
samba-66fa21ef73464188f5cb20e5fc96c5aa35d434b6.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/lib/recvfile.c')
-rw-r--r--source3/lib/recvfile.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c
index c9710a7ebe..ea01596421 100644
--- a/source3/lib/recvfile.c
+++ b/source3/lib/recvfile.c
@@ -148,6 +148,7 @@ ssize_t sys_recvfile(int fromfd,
static int pipefd[2] = { -1, -1 };
static bool try_splice_call = false;
size_t total_written = 0;
+ loff_t splice_offset = offset;
DEBUG(10,("sys_recvfile: from = %d, to = %d, "
"offset=%.0f, count = %lu\n",
@@ -180,7 +181,8 @@ ssize_t sys_recvfile(int fromfd,
while (count > 0) {
int nread, to_write;
- nread = splice(fromfd, NULL, pipefd[1], NULL, count, 0);
+ nread = splice(fromfd, NULL, pipefd[1], NULL,
+ MIN(count, 16384), SPLICE_F_MOVE);
if (nread == -1) {
if (errno == EINTR) {
continue;
@@ -197,12 +199,12 @@ ssize_t sys_recvfile(int fromfd,
to_write = nread;
while (to_write > 0) {
int thistime;
- thistime = splice(pipefd[0], NULL, tofd, &offset,
- to_write, 0);
+ thistime = splice(pipefd[0], NULL, tofd,
+ &splice_offset, to_write,
+ SPLICE_F_MOVE);
if (thistime == -1) {
goto done;
}
- offset += thistime;
to_write -= thistime;
}