Bug in isatty (errno setting/clearing)

M.J.Shannon mjs at eagle.UUCP
Sun Aug 4 01:17:28 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

Some things to ponder before you use the f(lame|ollowup) key:

	V6 had no stdio library (it *did* have a "portable C library", which
		stdio was (loosely) based on).

	I doubt that the person who started the original discussion is using
		V6, so the comments about obsolete function semantics is only
		of historical interest.

	The 4.2BSD manual (as quoted above) *explicitly* defines the semantics
		of errno.  To wit, "Thus, errno should be tested only after an
		error has occurred."

	The manual for the system in use is the only one applicable to the
		question at hand.  Different versions of the system behave
		differently (is *anyone* surprised at this?).

	The question at hand has been fully answered and explained.  Can we now
		move on to something more serious?
-- 
	Marty Shannon
UUCP:	ihnp4!eagle!mjs
Phone:	+1 201 522 6063

Warped people are throwbacks from the days of the United Federation of Planets.



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