X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libatalk%2Fdsi%2Fdsi_stream.c;h=6c502b0bcea37796af1c71fe03c5aaa05b0b1442;hb=22ad101eb72bf10fe5144526209798c677b2d1d8;hp=97eb8ad717e96b17c493df472a2254be318a0c15;hpb=a83e8197c7b8af45f8d56acf158920c03698bfc6;p=netatalk.git diff --git a/libatalk/dsi/dsi_stream.c b/libatalk/dsi/dsi_stream.c index 97eb8ad7..6c502b0b 100644 --- a/libatalk/dsi/dsi_stream.c +++ b/libatalk/dsi/dsi_stream.c @@ -364,7 +364,9 @@ ssize_t dsi_stream_read_file(DSI *dsi, const int fromfd, off_t offset, const siz sfvcnt = 2; vec[0].sfv_fd = SFV_FD_SELF; vec[0].sfv_flag = 0; - vec[0].sfv_off = block; + /* Cast to unsigned long to prevent sign extension of the + * pointer value for the LFS case; see Apache PR 39463. */ + vec[0].sfv_off = (unsigned long)block; vec[0].sfv_len = DSI_BLOCKSIZ; vec[1].sfv_fd = fromfd; vec[1].sfv_flag = 0; @@ -398,7 +400,7 @@ ssize_t dsi_stream_read_file(DSI *dsi, const int fromfd, off_t offset, const siz #endif /* defined(SOLARIS) || defined(FREEBSD) */ #endif /* HAVE_SENDFILEV */ - if (dsi_peek(dsi)) { + if (dsi_peek(dsi) != 0) { ret = -1; goto exit; } @@ -469,10 +471,6 @@ size_t dsi_stream_read(DSI *dsi, void *data, const size_t length) stored += len; } else { /* eof or error */ /* don't log EOF error if it's just after connect (OSX 10.3 probe) */ -#if 0 - if (errno == ECONNRESET) - dsi->flags |= DSI_GOT_ECONNRESET; -#endif if (len || stored || dsi->read_count) { if (! (dsi->flags & DSI_DISCONNECTED)) { LOG(log_error, logtype_dsi, "dsi_stream_read: len:%d, %s", @@ -531,7 +529,7 @@ int dsi_stream_send(DSI *dsi, void *buf, size_t length) break; else if (len < 0) { /* error */ if (errno == EAGAIN || errno == EWOULDBLOCK) { - if (!dsi_peek(dsi)) { + if (dsi_peek(dsi) == 0) { continue; } } @@ -594,7 +592,7 @@ int dsi_stream_receive(DSI *dsi) dsi->clientID = ntohs(dsi->header.dsi_requestID); /* make sure we don't over-write our buffers. */ - dsi->cmdlen = MIN(ntohl(dsi->header.dsi_len), DSI_CMDSIZ); + dsi->cmdlen = MIN(ntohl(dsi->header.dsi_len), dsi->server_quantum); if (dsi_stream_read(dsi, dsi->commands, dsi->cmdlen) != dsi->cmdlen) return 0;