httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: httpd-2.0/server log.c
Date Thu, 23 May 2002 21:25:48 GMT
On Thu, May 23, 2002 at 12:19:09PM -0000, trawick@apache.org wrote:
>...
>   +++ log.c	23 May 2002 12:19:09 -0000	1.121
>...
>   +    bytes_wanted = BUFFER_SIZE;
>   +    endptr = buf = apr_palloc(p, BUFFER_SIZE);
>   +    do {
>   +        bytes_read = bytes_wanted;
>   +        rv = apr_file_read(pid_file, endptr, &bytes_read);
>   +        if (rv != APR_SUCCESS && rv != APR_EOF) {
>   +            return rv;
>   +        }
>   +        bytes_wanted -= bytes_read;
>   +        endptr += bytes_read; 
>   +    }
>   +    while (bytes_wanted > 0 && rv != APR_EOF);

Oof... needlessly complicated. Just use apr_file_read_full(). It will return
all the bytes that you ask for, unless an error condition occurs (EOF).
There is no need to do any looping.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message