gnutls-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnutls-dev] Re: Gnutls4win: Problem with custom push/pull functions, er


From: Tim Kosse
Subject: [gnutls-dev] Re: Gnutls4win: Problem with custom push/pull functions, errno and Visual Studio (Workaround included)
Date: Sun, 05 Nov 2006 13:56:50 +0100
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Simon Josefsson wrote:
> @@ -701,6 +754,8 @@
>    while (left > 0)
>      {
>  
> +      session->internals.errnum = 0;
> +
>        if (session->internals._gnutls_push_func == NULL)
>       i = send (GNUTLS_POINTER_TO_INT(fd), &ptr[n - left], left, 0);
>        else
> @@ -708,7 +763,10 @@
>  
>        if (i == -1)
>       {
> -       if (errno == EAGAIN || errno == EINTR)
> +       int err = session->internals.errnum ? session->internals.errnum
> +         : errno;
> +
> +       if (err == EAGAIN || err == EINTR)
>           {
>             session->internals.record_send_buffer_prev_size += n - left;
>  
> @@ -726,7 +784,7 @@
>               ("WRITE: Interrupted. Stored %d bytes to buffer. Already sent 
> %d bytes.\n",
>                left, n - left);
>  
> -           retval = RET (errno);
> +           retval = RET (err);
>  
>             return retval;
>           }
> 

What if errno != 0 prior to calling the push function and the push
function just sets session->internals.errnum to 0?
I think errno has to be initialized with 0 as well.

Tim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFTd9y8N9+lcqiUkURAhrKAKDjwfDrMP2Rvk/8GbO5tf0oP12rMwCeN7Fm
fYdANRbe30rV4teH53hnPtc=
=8tu6
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]