X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libatalk%2Fadouble%2Fad_sendfile.c;h=2730644b69adc1669868fe5d3da4bb6b4cd1971e;hb=371efee757ed56fd9e2f46b39fae625924d2cfc2;hp=8c50dcf804cf0f3ea304bc84c55a2d3610cfe579;hpb=7be2a68aa70fa5641e944ad0aed6f699736d3de9;p=netatalk.git diff --git a/libatalk/adouble/ad_sendfile.c b/libatalk/adouble/ad_sendfile.c index 8c50dcf8..2730644b 100644 --- a/libatalk/adouble/ad_sendfile.c +++ b/libatalk/adouble/ad_sendfile.c @@ -62,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 @@ -94,30 +103,4 @@ int ad_readfile_init(const struct adouble *ad, return fd; } - - -/* ------------------------ */ -#if 0 -#ifdef HAVE_SENDFILE_WRITE -/* read from a socket and write to an adouble file */ -ssize_t ad_writefile(struct adouble *ad, const int eid, - const int sock, off_t off, const int end, - const size_t len) -{ -#ifdef __linux__ - ssize_t cc; - int fd; - - fd = ad_sendfile_init(ad, eid, &off, end); - if ((cc = sys_sendfile(fd, sock, &off, len)) < 0) - return -1; - - if ((eid != ADEID_DFORK) && (off > ad_getentrylen(ad, eid))) - ad_setentrylen(ad, eid, off); - - return cc; -#endif /* __linux__ */ -} -#endif /* HAVE_SENDFILE_WRITE */ -#endif /* 0 */ #endif