Commit 62189e9c authored by Greg Stein's avatar Greg Stein
Browse files

fix the (error) return values for the ap_r* functions.

Submitted by: Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87806 13f79535-47bb-0310-9956-ffa450edef68
parent 382220b0
Loading
Loading
Loading
Loading
+16 −13
Original line number Original line Diff line number Diff line
@@ -3075,10 +3075,11 @@ AP_DECLARE(int) ap_rputc(int c, request_rec *r)
    char c2 = (char)c;
    char c2 = (char)c;


    if (r->connection->aborted) {
    if (r->connection->aborted) {
	return EOF;
	return -1;
    }
    }


    (void) buffer_output(r, &c2, 1);
    if (buffer_output(r, &c2, 1) != APR_SUCCESS)
        return -1;


    return c;
    return c;
}
}
@@ -3088,11 +3089,10 @@ AP_DECLARE(int) ap_rputs(const char *str, request_rec *r)
    apr_size_t len;
    apr_size_t len;


    if (r->connection->aborted)
    if (r->connection->aborted)
        return EOF;
        return -1;
    if (*str == '\0')
        return 0;


    (void) buffer_output(r, str, len = strlen(str));
    if (buffer_output(r, str, len = strlen(str)) != APR_SUCCESS)
        return -1;


    return len;
    return len;
}
}
@@ -3100,9 +3100,10 @@ AP_DECLARE(int) ap_rputs(const char *str, request_rec *r)
AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r)
AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r)
{
{
    if (r->connection->aborted)
    if (r->connection->aborted)
        return EOF;
        return -1;


    (void) buffer_output(r, buf, nbyte);
    if (buffer_output(r, buf, nbyte) != APR_SUCCESS)
        return -1;


    return nbyte;
    return nbyte;
}
}
@@ -3113,11 +3114,12 @@ AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
    apr_size_t written;
    apr_size_t written;


    if (r->connection->aborted)
    if (r->connection->aborted)
        return EOF;
        return -1;


    /* ### fix this mechanism to allow more than 4K of output */
    /* ### fix this mechanism to allow more than 4K of output */
    written = apr_vsnprintf(buf, sizeof(buf), fmt, va);
    written = apr_vsnprintf(buf, sizeof(buf), fmt, va);
    (void) buffer_output(r, buf, written);
    if (buffer_output(r, buf, written) != APR_SUCCESS)
        return -1;


    return written;
    return written;
}
}
@@ -3128,7 +3130,7 @@ AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...)
    int n;
    int n;


    if (r->connection->aborted)
    if (r->connection->aborted)
        return EOF;
        return -1;


    va_start(va, fmt);
    va_start(va, fmt);
    n = ap_vrprintf(r, fmt, va);
    n = ap_vrprintf(r, fmt, va);
@@ -3145,7 +3147,7 @@ AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r, ...)
    apr_size_t written;
    apr_size_t written;


    if (r->connection->aborted)
    if (r->connection->aborted)
        return EOF;
        return -1;


    /* ### TODO: if the total output is large, put all the strings
    /* ### TODO: if the total output is large, put all the strings
       ### into a single brigade, rather than flushing each time we
       ### into a single brigade, rather than flushing each time we
@@ -3176,7 +3178,8 @@ AP_DECLARE(int) ap_rflush(request_rec *r)
    bb = apr_brigade_create(r->pool);
    bb = apr_brigade_create(r->pool);
    b = apr_bucket_create_flush();
    b = apr_bucket_create_flush();
    APR_BRIGADE_INSERT_TAIL(bb, b);
    APR_BRIGADE_INSERT_TAIL(bb, b);
    ap_pass_brigade(r->output_filters, bb);
    if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS)
        return -1;
    return 0;
    return 0;
}
}