[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r9806 - in trunk/subversion: include libsvn_subr

From: Branko Čibej <brane_at_xbc.nu>
Date: 2004-05-21 16:33:35 CEST

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

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.