On Thu, May 23, 2002 at 12:19:09PM -0000, [EMAIL PROTECTED] 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/

Reply via email to