]> granicus.if.org Git - apache/commitdiff
Change ap_bread's interface to no longer require errno.
authorManoj Kasichainula <manoj@apache.org>
Sat, 30 Oct 1999 02:06:34 +0000 (02:06 +0000)
committerManoj Kasichainula <manoj@apache.org>
Sat, 30 Oct 1999 02:06:34 +0000 (02:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84073 13f79535-47bb-0310-9956-ffa450edef68

modules/echo/mod_echo.c
modules/http/http_protocol.c
modules/metadata/mod_mime_magic.c

index dc4c23fa8036db94fc79e1618c26c3549e9dd3a0..e8327193e1df02a11385e976e8e412719a1e0014 100644 (file)
@@ -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);
index cdaec1985cd3f4543f4f76920382e87512b246a1..cc08e49407837af21326b45b37285331b77a63f9 100644 (file)
@@ -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;
index a6a53645cdddc83936c2dfaa31ab8301a3476e1c..80babf85b45a2c86f6b8db45f7c5e4f9bc0d77de 100644 (file)
@@ -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;
     }