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;
#endif /* defined(SOLARIS) || defined(FREEBSD) */
#endif /* HAVE_SENDFILEV */
- if (dsi_peek(dsi)) {
+ if (dsi_peek(dsi) != 0) {
ret = -1;
goto exit;
}
break;
else if (len < 0) { /* error */
if (errno == EAGAIN || errno == EWOULDBLOCK) {
- if (!dsi_peek(dsi)) {
+ if (dsi_peek(dsi) == 0) {
continue;
}
}
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;