From: Jeremy Allison Date: Sun, 25 Dec 2011 05:12:09 +0000 (-0800) Subject: Fix bug #8679 - recvfile code path using splice() on Linux leaves data in the pipe... X-Git-Tag: tevent-0.9.15~603 X-Git-Url: http://git.samba.org/?p=ddiss%2Fsamba.git;a=commitdiff_plain;h=eb617374a673bb1189dd9b6bccbf3f1d9fb91010 Fix bug #8679 - recvfile code path using splice() on Linux leaves data in the pipe on short write Bug found and fix suggested by Andrew Bartlett. Autobuild-User: Jeremy Allison Autobuild-Date: Sun Dec 25 07:46:38 CET 2011 on sn-devel-104 --- diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c index 7cbb8a0b92e..5d1c0b2c55f 100644 --- a/source3/lib/recvfile.c +++ b/source3/lib/recvfile.c @@ -214,10 +214,9 @@ ssize_t sys_recvfile(int fromfd, } done: - if (total_written < count) { + if (count) { int saved_errno = errno; - if (drain_socket(fromfd, count-total_written) != - count-total_written) { + if (drain_socket(fromfd, count) != count) { /* socket is dead. */ return -1; }