X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libatalk%2Fadouble%2Fad_sendfile.c;h=3cb28e7802c935db16ab4acf80645db577b43816;hb=1997a50e89d139cc15e05db4f3e40412b5fe4ce3;hp=aabb61ce106eff5f80e69d09ab06149facbfdb51;hpb=08d710224e346b26227e08d5a044350198b1bbd9;p=netatalk.git diff --git a/libatalk/adouble/ad_sendfile.c b/libatalk/adouble/ad_sendfile.c index aabb61ce..3cb28e78 100644 --- a/libatalk/adouble/ad_sendfile.c +++ b/libatalk/adouble/ad_sendfile.c @@ -1,6 +1,4 @@ /* - * $Id: ad_sendfile.c,v 1.11 2010-01-21 14:14:49 didg Exp $ - * * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu) * All rights reserved. See COPYRIGHT. * @@ -32,18 +30,15 @@ #endif /* HAVE_CONFIG_H */ #ifdef WITH_SENDFILE - -#include - #include - #include #include - #include +#include #include -#include "ad_private.h" + +#include "ad_lock.h" #if defined(SENDFILE_FLAVOR_LINUX) #include @@ -67,7 +62,16 @@ ssize_t sys_sendfile(int tofd, int fromfd, off_t *offset, size_t count) #include ssize_t sys_sendfile(int tofd, int fromfd, off_t *offset, size_t count) { - return sendfile(fromfd, tofd, *offset, count, NULL, offset, 0); + off_t len; + int ret; + + ret = sendfile(fromfd, tofd, *offset, count, NULL, &len, 0); + + *offset += len; + + if (ret != 0) + return -1; + return len; } #else