apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: apr_file_read() may return an error while bytes were read (windows only)
Date Thu, 12 Jun 2014 14:17:54 GMT
On Thu, Jun 12, 2014 at 4:12 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
> @@ -191,6 +192,10 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t
>                  if (thefile->flags & APR_FOPEN_XTHREAD) {
>                      apr_thread_mutex_unlock(thefile->mutex);
>                  }
> +                if (bytes_read) {
> +                    *len = bytes_read;
> +                    return APR_SUCCESS;
> +                }

Hm, I guess the following is better (forces *len = 0 on error with no data) :
+                *len = bytes_read;
+                if (*len) {
+                    return APR_SUCCESS;
+                }

>                  return rv;

Mime
View raw message