apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: [PATCH] apr_file_writev() on UNIX
Date Tue, 05 Oct 2004 20:40:15 GMT
On Tue, Oct 05, 2004 at 11:23:35AM -0600, Jean-Jacques Clar wrote:
> >>> <jorton@redhat.com> 10/05/04 12:16 AM >>>
> On Mon, Oct 04, 2004 at 06:11:57PM -0600, Jean-Jacques Clar wrote:
> >> If HAS_WRITEV is not defined the current code
> >> will just push the first vector to the target.
> >> The function should write all the vectors or none.
> 
> >There is no guarantee that writev(2) writes all the vectors, it's
> >allowed to return short just like write(2) is, so why should
> >apr_file_writev() give such a guarantee only for the non-writev-based
> >implementation?
>
> If HAS_WRITEV is not defined, there is a bug inside apr_file_writev().
> Only the first vector will be written to the file.
> How do you think that bug should be fixed?

I don't think that's a bug.  apr_file_writev() should be allowed to
return short, as the writev()-based implementation may already do this
too.  So the !HAS_WRITEV implementation is valid.

> apr_file_writev() is used multiple times without alternatives in
> mod_disk_cache.c and the current implementation is failing without
> informing the caller or any failure if writev() is not available.

Right, the bug is in how the function is used.  It's the same as calling
apr_file_write() and presuming it won't return short.  The fix is to
call apr_file_write_full(), in that case.  In this case, there is no
apr_file_writev_full(), so that should be fixed.

joe

Mime
View raw message