Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 1998 14:12:52 PDT
From:      Bill Fenner <fenner@parc.xerox.com>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        fenner@parc.xerox.com (Bill Fenner), peter@netplex.com.au, current@FreeBSD.ORG
Subject:   Re: Bogus errno twiddling by lstat... 
Message-ID:  <199806192112.OAA16187@mango.parc.xerox.com>
In-Reply-To: Your message of "Fri, 19 Jun 1998 11:51:20 PDT." <199806191851.LAA12551@usr06.primenet.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <199806191851.LAA12551@usr06.primenet.com>you write:
>So the question becomes: "At what point can I expect a library routine
>to behave like a system call"?

When it's documented to do so.

>I *thought* that there were some ISO/POSIX requirements that errno
>not be touched in non-error cases

ISO/ANSI C says that library functions may modify errno unless the
standard says otherwise.  The standard says otherwise for at least
the math functions, which set errno to things like EDOM and ERANGE
or leave it alone if no error occurred, and the calling sequence

	errno = 0;
	y = asin(x);
	if (errno == EDOM) {
		...
	}

is meant to work in that situation.  However, normal library
functions are explicitly allowed to modify errno even if no error
occurs.

  Bill

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806192112.OAA16187>