Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site frog.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!think!mit-eddie!cybvax0!frog!john From: john@frog.UUCP (John Woods) Newsgroups: net.bugs.4bsd,net.unix-wizards,net.bugs.usg Subject: Re: Bug in isatty (all systems!) Message-ID: <247@frog.UUCP> Date: Tue, 30-Jul-85 17:55:58 EDT Article-I.D.: frog.247 Posted: Tue Jul 30 17:55:58 1985 Date-Received: Thu, 1-Aug-85 07:42:56 EDT References: <6367@ucla-cs.ARPA> <997@sdcsvax.UUCP> <1017@ulysses.UUCP> <1730@reed.UUCP> Organization: Charles River Data Systems, Framingham MA Lines: 25 Xref: linus net.bugs.4bsd:1342 net.unix-wizards:11292 net.bugs.usg:257 > 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@MIT-XX.ARPA