Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!mtune!akguc!akgua!gatech!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.unix,net.unix-wizards Subject: Re: Not a typewriter Message-ID: <2024@umcp-cs.UUCP> Date: Sun, 15-Jun-86 17:23:05 EDT Article-I.D.: umcp-cs.2024 Posted: Sun Jun 15 17:23:05 1986 Date-Received: Tue, 17-Jun-86 11:07:30 EDT References: <1683@homxb.UUCP> <542@codas.ATT.UUCP> Reply-To: chris@maryland.UUCP (Chris Torek) Organization: University of Maryland, Dept. of Computer Sci. Lines: 33 Xref: watmath net.unix:8173 net.unix-wizards:18421 In article <542@codas.ATT.UUCP> mikel@codas.ATT.UUCP (Mikel Manitius) writes: >I think there may be one or two system calls that will alter >errno to be 25, without returning a non-zero value, when in >fact there was no error. There are many library routines that may alter errno without in fact failing; but there are no system calls that will do so. This is really the main distinction between manual sections 2 and 3, as far as user code is concerned. Incidentally, this points up a problem even with `good' error handling routines. I tend to write, e.g., if ((fp = fopen(name, "w")) == NULL) error(1, errno, "cannot open %s for writing", name); which usually results in a message like this: snerfle: cannot open breuglitz for writing: Permission denied However, if the open failure were due to, say, running out of stdio descriptors (but NOT file descriptors), it might say something wildly inappropriate: snerfle: cannot open breuglitz for writing: Not a directory My own opinion is that section 3 routines should set errno on errors too. (Actually, I think that `errno' itself should go away, but I have no good replacement for it.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu