From owner-freebsd-bugs Fri Nov 7 06:40:03 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id GAA02281 for bugs-outgoing; Fri, 7 Nov 1997 06:40:03 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id GAA02255; Fri, 7 Nov 1997 06:40:01 -0800 (PST) (envelope-from gnats) Date: Fri, 7 Nov 1997 06:40:01 -0800 (PST) Message-Id: <199711071440.GAA02255@hub.freebsd.org> To: freebsd-bugs Cc: From: Garrett Wollman Subject: Re: bin/4961: Problems with fseek and fprints Reply-To: Garrett Wollman Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR bin/4961; it has been noted by GNATS. From: Garrett Wollman To: Bill Fenner Cc: Garrett Wollman , freebsd-gnats-submit@freebsd.org Subject: Re: bin/4961: Problems with fseek and fprints Date: Fri, 7 Nov 1997 09:33:55 -0500 (EST) < 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