gnutls-devel
[Top][All Lists]
Advanced

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

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


From: Werner Koch
Subject: Re: [gnutls-dev] Re: Gnutls4win: Problem with custom push/pull functions, errno and Visual Studio (Workaround included)
Date: Mon, 06 Nov 2006 14:46:01 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6)

On Mon,  6 Nov 2006 12:47, address@hidden said:

> value before using the value in errno.  However, it seems harmless to
> set errno to 0 before the call, and it might catch errors in custom

If you want gnutls to behave similar to Posix or ISO-C, you should not
set errno to 0.

Posix states that errno will be not be set to 0 by any function
decribed in this volume of IEEE-1003.1.  Setting errno to 0 without an
error changes the semantics.

 if ( open (...) < 0 )
   {
     gnutls_foo ()
     fprintf (stderr, "error from open: %s\n", strerror (errno));
   }

Should print an error if open fails.  The printed error will be from
open or due to a failure of gnutls_foo.  If gnutls_foo succeeds, the
result would be a 

 error from open: No Error

That is probably not what the user expected.

Anyway, mixing different CRTs is not exactly a good idea.  You will
encounter more and more problems which are even harder to solve.  We
have the same problem with gpgol (an Outlook extension), however
Outlook handles extensions a bit different than a plain DLL and thus
the "only" problem we had to solve was to use the correct version of
free().  IIRC, the DLL mechanisms has some indirect linking features
whoch might be used to solve this problem. 


Shalom-Salam,

   Werner




reply via email to

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