[gnutls-dev] Re: Gnutls4win: Problem with custom push/pull
functions, errno and Visual Studio (Workaround included)
Tim Kosse
tim.kosse at filezilla-project.org
Sun Nov 5 13:56:50 CET 2006
-----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-----
More information about the Gnutls-dev
mailing list