Peter N. Lundblad wrote:
>On Thu, 20 May 2004 lundblad@tigris.org wrote:
>
>
>>Author: lundblad
>>Date: Thu May 20 18:30:05 2004
>>New Revision: 9806
>>
>>Log:
>>Actually check for write errors in svn_cmdline_printf, svn_cmdline__fprint and
>>svn_cmdline_fputs.
>>
>>* libsvn_subr/cmdline.c (svn_cmdline_fputs): Check the call of fputs()
>> fo errors and return it in that case.
>>
>>
>>Modified: trunk/subversion/libsvn_subr/cmdline.c
>>==============================================================================
>>--- trunk/subversion/libsvn_subr/cmdline.c (original)
>>+++ trunk/subversion/libsvn_subr/cmdline.c Thu May 20 18:30:05 2004
>>@@ -268,7 +268,21 @@
>> out = svn_cmdline_cstring_from_utf8_fuzzy (string, pool);
>> }
>>
>>- fputs (out, stream);
>>+ /* On POSIX systems, errno will be set on an error in fputs, but this might
>>+ not be the case on other platforms. We reset the OS error and only
>>+ use it if it was set by the below fputs call. Else, we just return
>>+ a generic error. */
>>+ apr_set_os_error (APR_SUCCESS);
>>
>>
This is not guaranteed to work. I also believe it is unnecessary, since
you only check errno if fputs failed, in which case it should always
have the correct value -- *if* the system sets it, which the C standard
does not require. POSIX might, though.
>>+ if (fputs (out, stream) == EOF)
>>+ {
>>+ apr_status_t status = apr_get_os_error ();
>>
>>
>
>This obviously works on my Linux box. Anyone who knows if this is correct
>on platforms such as Win32?
>
>
No, because apr_get_os_error() doesn't use errno on Win32.
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 21 16:35:22 2004