diff --git a/modules/echo/mod_echo.c b/modules/echo/mod_echo.c index dc4c23fa80..e8327193e1 100644 --- a/modules/echo/mod_echo.c +++ b/modules/echo/mod_echo.c @@ -39,7 +39,8 @@ static int process_echo_connection(conn_rec *c) for( ; ; ) { int w; - int r=ap_bread(c->client,buf,sizeof buf); + int r; + (void) ap_bread(c->client,buf,sizeof buf,&r); if(r <= 0) break; w=ap_bwrite(c->client,buf,r); diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index cdaec1985c..cc08e49407 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1813,17 +1813,21 @@ static long get_chunk_size(char *b) API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) { int c; - long len_read, len_to_read; + ap_size_t len_to_read; + ap_ssize_t len_read; long chunk_start = 0; unsigned long max_body; + ap_status_t rv; if (!r->read_chunked) { /* Content-length read */ len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; - len_read = ap_bread(r->connection->client, buffer, len_to_read); - if (len_read <= 0) { - if (len_read < 0) + rv = ap_bread(r->connection->client, buffer, len_to_read, &len_read); + if (len_read == 0) { /* error or eof */ + if (rv != APR_SUCCESS) { r->connection->keepalive = -1; - return len_read; + return -1; + } + return 0; } r->read_length += len_read; r->remaining -= len_read; @@ -1931,8 +1935,8 @@ API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining; - len_read = ap_bread(r->connection->client, buffer, len_to_read); - if (len_read <= 0) { + (void) ap_bread(r->connection->client, buffer, len_to_read, &len_read); + if (len_read == 0) { /* error or eof */ r->connection->keepalive = -1; return -1; } @@ -2072,7 +2076,9 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) char buf[IOBUFSIZE]; long total_bytes_sent = 0; long zero_timeout = 0; - int n, w, o; + int w, o; + ap_ssize_t n; + ap_status_t rv; if (length == 0) { return 0; @@ -2085,13 +2091,13 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) ap_bsetopt(fb, BO_TIMEOUT, &zero_timeout); while (!ap_is_aborted(r->connection)) { - n = ap_bread(fb, buf, sizeof(buf)); - if (n <= 0) { - if (n == 0) { + rv = ap_bread(fb, buf, sizeof(buf), &n); + if (n == 0) { + if (rv == APR_SUCCESS) { /* eof */ (void) ap_rflush(r); break; } - if (n == -1 && errno != EAGAIN) { + if (rv != APR_EAGAIN) { r->connection->aborted = 1; break; } @@ -2101,9 +2107,9 @@ API_EXPORT(long) ap_send_fb_length(BUFF *fb, request_rec *r, long length) } ap_bsetopt(fb, BO_TIMEOUT, &r->server->timeout); - n = ap_bread(fb, buf, sizeof(buf)); - if (n <= 0) { - if (n == 0) { + rv = ap_bread(fb, buf, sizeof(buf), &n); + if (n == 0) { + if (rv == APR_SUCCESS) { /* eof */ (void) ap_rflush(r); } r->connection->aborted = 1; diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c index a6a53645cd..80babf85b4 100644 --- a/modules/metadata/mod_mime_magic.c +++ b/modules/metadata/mod_mime_magic.c @@ -2173,6 +2173,7 @@ static int uncompress(request_rec *r, int method, struct uncompress_parms parm; BUFF *bout; ap_context_t *sub_pool; + ap_status_t rv; parm.r = r; parm.method = method; @@ -2192,9 +2193,10 @@ static int uncompress(request_rec *r, int method, } *newch = (unsigned char *) ap_palloc(r->pool, n); - if ((n = ap_bread(bout, *newch, n)) <= 0) { + rv = ap_bread(bout, *newch, n, &n); + if (n == 0) { ap_destroy_pool(sub_pool); - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, MODNAME ": read failed %s", r->filename); return -1; }