delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/01/21/00:36:46

From: DAUTREVAUX AT microprocess DOT com (Bernard Dautrevaux)
Subject: RE: setting errno
21 Jan 1999 00:36:46 -0800 :
Message-ID: <8135911A809AD211AF6300A02480D1750348C7.cygnus.gnu-win32@IIS000.microdata.fr>
Mime-Version: 1.0
To: "'Tim Taylor'" <ttaylor AT mitre DOT org>, gnu-win32 AT cygnus DOT com

> -----Message d'origine-----
> De:	Tim Taylor [SMTP:ttaylor AT mitre DOT org]
> Date:	mardi 19 janvier 1999 18:24
> À:	gnu-win32 AT cygnus DOT 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 AT microprocess DOT com
		b DOT dautrevaux AT usa DOT net
------------------------------------------------------------------------
------

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019