Date: Fri, 7 Nov 1997 06:40:01 -0800 (PST) From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> To: freebsd-bugs Subject: Re: bin/4961: Problems with fseek and fprints Message-ID: <199711071440.GAA02255@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/4961; it has been noted by GNATS. From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> To: Bill Fenner <fenner@parc.xerox.com> Cc: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, freebsd-gnats-submit@freebsd.org Subject: Re: bin/4961: Problems with fseek and fprints Date: Fri, 7 Nov 1997 09:33:55 -0500 (EST) <<On Thu, 6 Nov 1997 21:05:50 PST, Bill Fenner <fenner@parc.xerox.com> said: > Aha. Plaugher's "Standard C Library" says that the "right" way > to use errno is: > errno = 0; > foo(); > if (errno) ... > so library functions shouldn't set errno if an error did not occur. > Does that mean that malloc should save errno around the readlink()? Applications should not inspect errno unless a library call which is documented as setting it returned an error indication. If there is no error indicated, there is still no guarantee that errno will keep its value. It was done this way specifically to permit the traditional implementation of stdio, which calls isatty() to determine whether to buffer output or not (and in the latter case, isatty() has the side effect of setting errno to ENOTTY). Unless an error is indicated, the value of errno is indeterminate. -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711071440.GAA02255>