Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 (Fortune 01.1b1); site graffiti.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!ut-sally!ut-ngp!shell!graffiti!peter From: peter@graffiti.UUCP (Peter da Silva) Newsgroups: net.bugs.4bsd,net.unix-wizards,net.bugs.usg Subject: Re: Bug in isatty (all systems!) Message-ID: <157@graffiti.UUCP> Date: Mon, 2-Sep-85 09:32:31 EDT Article-I.D.: graffiti.157 Posted: Mon Sep 2 09:32:31 1985 Date-Received: Wed, 4-Sep-85 06:26:31 EDT References: <6367@ucla-cs.ARPA> <997@sdcsvax.UUCP> <1017@ulysses.UUCP> <1730@reed.UUCP> <1298@eagle.UUCP> <1023@sdcsvax.UUCP> Organization: The Power Elite, Houston, TX Lines: 29 Xref: watmath net.bugs.4bsd:1733 net.unix-wizards:14691 net.bugs.usg:329 > > No, that sentence should read: > > In other words, don't check errno after calling a library routine > > unless it returns an error indication *and* the manual says that it > > sets errno to something meaningful. errno is an indication of how the last system call failed. In most cases in section 3 this is also an indication of how the function itself failed. isatty, fopen(..., "r"), and a few other functions (not available in my short-term memory) do something other than return a failure when a system call fails. In fact that's how isatty generally works: it tries to do an lseek on the file descriptor and returns true if it fails (no flames if it does some other system call, please...). Fopen(..., "w") does an open(2) then a creat(2) (except maybe in SV) if the open fails. > If you're a defender of the cult of UNIX and its teachings, the latter > is a reasonable statement. If you want clear and unambiguous documentation > (which fits my definition of a printed "standard") the former is better. Surprise! I agree that it wouldn't be hard to clear errno on non-fatal syscall failures in section (3). There are probably people out there, however, whose code depends on errno being sacred to all but system calls. That last statement should read: "If you're trying to use the system as documented, the latter is a reasonable statement. If you're pointing out a possible error to be fixed in the next release, the former is better." From context it's hard to tell whether your original posting was a complaint or a request for help, and the writer of ">>" above obviously assumed it was the latter. Flames about "the cult of UNIX" are not informative.