]> arthur.barton.de Git - netatalk.git/commitdiff
Fixes for sendfile
authorFrank Lahm <franklahm@googlemail.com>
Fri, 27 Apr 2012 16:00:36 +0000 (18:00 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Fri, 27 Apr 2012 16:00:36 +0000 (18:00 +0200)
libatalk/dsi/dsi_stream.c

index 79b52c1445b27f3cc1f92a6d00787862df831f5c..97eb8ad717e96b17c493df472a2254be318a0c15 100644 (file)
@@ -385,18 +385,19 @@ ssize_t dsi_stream_read_file(DSI *dsi, const int fromfd, off_t offset, const siz
             switch (errno) {
             case EINTR:
             case EAGAIN:
-#if defined(SOLARIS) || defined(FREEBSD)
+                len = 0;
 #ifdef HAVE_SENDFILEV
                 len = (size_t)nwritten;
 #else
+#if defined(SOLARIS) || defined(FREEBSD)
                 if (pos > offset) {
                     /* we actually have sent sth., adjust counters and keep trying */
                     len = pos - offset;
-                    written += len;
                     offset = pos;
                 }
-#endif /* HAVE_SENDFILEV */
 #endif /* defined(SOLARIS) || defined(FREEBSD) */
+#endif /* HAVE_SENDFILEV */
+
                 if (dsi_peek(dsi)) {
                     ret = -1;
                     goto exit;
@@ -424,7 +425,7 @@ ssize_t dsi_stream_read_file(DSI *dsi, const int fromfd, off_t offset, const siz
             vec[0].sfv_len -= len;
         }
 #endif  /* HAVE_SENDFILEV */
-
+        LOG(log_maxdebug, logtype_dsi, "dsi_stream_read_file: wrote: %zd", len);
         written += len;
     }
 #ifdef HAVE_SENDFILEV