Xref: utzoo comp.unix.internals:828 comp.unix.programmer:326 Path: utzoo!attcan!uunet!aplcen!haven!uflorida!gatech!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!stl!robobar!ronald From: ronald@robobar.co.uk (Ronald S H Khoo) Newsgroups: comp.unix.internals,comp.unix.programmer Subject: Re: Checking return values (was: Trojan Horses, NFS, etc.) Message-ID: <1990Oct25.075856.4923@robobar.co.uk> Date: 25 Oct 90 07:58:56 GMT References: <1885@necisa.ho.necisa.oz> <4315@pkmab.se> <1990Oct24.193712.8693@athena.mit.edu> Followup-To: comp.unix.programmer Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 25 [ wizard readers: skip now. followups redirected. ] scs@adam.mit.edu (Steve Summit) writes: > default: > fprintf(stderr, "%s: can't open %s: ", > progname, name); > perror(""); usenet: can't open scs@adam.mit.edu: not a tty. (Steve, I'm shocked! *you* of all people :-) For those of you still puzzled: perror() must be called *immediately* after the error returns, or the internal error state may be modified by calls to system calls in the intervening situation. It's annoying, but perror(name); fprintf(stderr, "%s: error opening %s (see error message above)\n", progname, name); is more correct. -- ronald@robobar.co.uk +44 81 991 1142 (O) +44 71 229 7741 (H)