On Mon, Sep 29, 2008 at 8:26 AM, Daniel Stenberg <[EMAIL PROTECTED]> wrote:
> On Fri, 12 Sep 2008, E L wrote:
>
>>> Your patch was real close, but it doesn't address the above statement.
>>>
>>> Could you verify if the attached patch works fine for you, and report
>>> back to the list, so that someone might commit it to CVS ?
>>
>> Right now, the code works because errno is only checked if the result of
>> the socket call fail, so clearing it before the call is not needed. The
>> bigger issue is that on Windows, send() and recv() do not set errno at all.
>> http://msdn.microsoft.com/en-us/library/ms737828(VS.85).aspx
>>
>> I'm running the patched version right now and it is working.
>
> Right, but can you please answer to Yang's question whether his version of
> the fix works for you?
>
> That looks cleaner code-wise to me, so I would prefer to have his version
> get committed!
>

I missed his patch, I was focused on the first statement which talked
about setting errno to 0 before the call.  I found the patch in the
mail archive and it does not work for all cases.  That patch only
covers the 2 recv() calls, but there are also 3 send() calls which
have the same issue.  Rather than duplicating the switch code 5 times,
I thought it better to have it one spot.

Also, the code needs to know whether there was an error before calling
WSAGetLastError() because successful calls to win32 socket functions
do not necessarily clear the stored error.  Alternatively, if the
result of recv() or send() is not checked, then WSASetLastError(0)
should be called before calling the socket functions.
http://msdn.microsoft.com/en-us/library/ms741580(VS.85).aspx.

Eric

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to