apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Gilbert" <2jx64e...@sneakemail.com>
Subject Re: [PATCH] Fix for Subversion issue #1789
Date Fri, 16 Mar 2007 05:57:44 GMT
At 01:27 AM 3/15/2007 -0500, William A. Rowe, Jr. wrote:
>Jonathan Gilbert wrote:
[snip]
>> Index: file_io/win32/readwrite.c
>> ===================================================================
>> --- file_io/win32/readwrite.c	(revision 515905)
>> +++ file_io/win32/readwrite.c	(working copy)
>> @@ -326,9 +326,60 @@
>>              rv = APR_SUCCESS;
>>          }
>>          else {
>> -            (*nbytes) = 0;
>>              rv = apr_get_os_error();
>> -            if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
>> +            if (rv == APR_FROM_OS_ERROR(ERROR_INSUFFICIENT_BUFFER)) {
[snip]
>> +            }
>> +            else if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
[snip]
>>              }
>> +
>> +            (*nbytes) = 0;
>
>We can't return 0 bytes written, too many apps will presume 0 means file
>closed, other signals tripped, error etc.  We should do at least one
>short-write before returning in either case.

The return of 0 bytes written is only if it actually returns an error
state. The ERROR_INSUFFICIENT_BUFFER branch of the 'if' is, in all cases,
exited with a 'return', so that assignment to nbytes does not get executed
(that's why it was moved down there). The assignment is part of existing
behaviour that was present before I made the patch.

Jonathan Gilbert

Mime
View raw message