Bug in isatty (errno setting/clearing)

David Barto barto at celerity.UUCP
Fri Aug 2 01:17:47 AEST 1985


In article <2200011 at uiucuxc> hamilton at uiucuxc.Uiuc.ARPA writes:
>
>>  MY 4.2bsd manual says:
>>      ... An
>>     error number is also made available in the external variable
>>     _errno_, which is not cleared on successful calls.  Thus _errno_
>>     should be tested only after an error has occurred.
>>
>    notice that that quote is from intro(2), while the functions
>causing all this ruckus are from section 3, and intro(3) mentions
>errno only in the context of math functions.  i don't want to dig
>out my V6 manuals, but i'm fairly sure errno used to be exclusively
>maintained by the system call interface functions.
>	wayne ({decvax,ucbvax}!pur-ee!uiucdcs!uiucuxc!)hamilton

I got out MY V6 manuals and the following is a quote from the getc(III)

DIAGNOSTICS
	c-bit is set on EOF or error; from C, negative return indicates
	EOF.  Moreover, 'errno' is set by this routine just as it is for
	a system call (see introduction (II)).

Also putc, putw, fcreat, fflush, all happen to munge errno, as necessary.

So in V6, we have errno munged by the library routines in section 3.
-- 
David Barto, Celerity Computing, San Diego Ca, (619) 271-9940
decvax-\    bang-\			ARPA: celerity!barto at sdcsvax.ARPA
ucbvax--\   akgua-\
ihnp4----\-sdcsvax-\-celerity!barto

	"There are no moral lessons in nature" - Darwin



More information about the Comp.bugs.4bsd.ucb-fixes mailing list