Bug in isatty (all systems!)

John Woods john at frog.UUCP
Wed Jul 31 07:55:58 AEST 1985


>   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.
> 
>   What does "not cleared on successful calls" mean to you?  To me, it
> means that if I set errno = 0 in the beginning of my program, it will
> stay zero until a system call _fails_, then it will stay non-zero long
> enough for me to do something about it.  Now if a perfectly successful
> operation sets errno and does not bother to clear it, how can I depend
> on errno as an indication that something went _wrong_?
> 
You can't.  For once, the UNIX manual was CRYSTAL CLEAR on something, and you
even quoted it!

What does "Thus _errno_ should be tested only after an error has occurred."
mean to you?

Repeat it softly to yourself until you either understand it or are hauled away
in a butterfly net.

--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc at MIT-XX.ARPA



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