setting errno

Bernard Dautrevaux DAUTREVAUX@microprocess.com
Sun Jan 31 23:52:00 GMT 1999


> -----Message d'origine-----
> De:	Tim Taylor [SMTP:ttaylor@mitre.org]
> Date:	mardi 19 janvier 1999 18:24
> À:	gnu-win32@cygnus.com
> Objet:	setting errno
> 
> I'm porting a program that sets errno if an operation fails.  However,
> in
> the B20.1 errno is a macro that dereferences the pointer returned by a
> function #define errno (*__errno())
> 
> What is the proper way to set errno in cygwin?
> 
Do you mean that "errno = Exxx;" fails? Iwould have expected it to work
without any problem; the only problem this causse is that its not
possible to declare a static (or global) variable and initialize it by
"static perrno = &errno;" (but I'm not sure if ANSI C requires this to
work...).

> Based on comments I've read in the headers, it appears that the
> following
> will work:
> 
> _REENT->_errno = xxx
> 
What's "_REENT"? I don't know, but this seems utterly non-portable...

> Is this correct, or is there a more compatible or preferred way of
> doing this?
> 
I would just simply use "errno = xxx;" I'm sure I do this all the time
and I never get any error...



------------------------------------------------------------------------
------
Bernard Dautrevaux
Microprocess Ingéniérie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
------------------------------------------------------------------------
------

>  
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list