From 07125589fce1215b02b85010c9b0d330d6cae2e6 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 23 Sep 2006 16:45:26 +0000 Subject: [PATCH] Linux sendfile returns number of bytes written. Detected by: Xing Li git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1120 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_pool.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 08da4686..2b5453a8 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -163,10 +163,9 @@ WRK_Sendfile(struct worker *w, int fd, off_t off, unsigned len) } while (0); #elif defined(__linux__) do { - if (WRK_Flush(w) == 0) { - if (sendfile(*w->wfd, fd, &off, len) != 0) - w->werr++; - } + if (WRK_Flush(w) == 0 && + sendfile(*w->wfd, fd, &off, len) != len) + w->werr++; } while (0); #else #error Unknown sendfile() implementation -- 2.39.5