>>> <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?
 
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. Do you see a better solution than fixing
apr_file_writev() for that case?
Maybe the question is why do we need to have the HAS_WRITEV define?
Are there any Unix based system that do not have writev() implemented?

>What you're looking for, perhaps, is an apr_file_writev_full(), which
>guarantees "all bytes are written, or failure"?
I am not looking for replacement, there are vectors that needs to be written
to a file in the current case.
Thanks,
JJ