home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sgi:18338 comp.sys.sgi.bugs:46 comp.unix.ultrix:9081
- Path: sparky!uunet!olivea!sgigate!odin!twilight!zuni!anchor!olson
- From: olson@anchor.esd.sgi.com (Dave Olson)
- Newsgroups: comp.sys.sgi,comp.sys.sgi.bugs,comp.unix.ultrix
- Subject: Re: tempnam(3S) bug, possibly on all MIPS
- Message-ID: <u2hc1jk@zuni.esd.sgi.com>
- Date: 26 Dec 92 02:33:39 GMT
- References: <1gu849INNp6k@menudo.uh.edu> <tqcnepk@zuni.esd.sgi.com> <1992Dec24.011451.497@pixar.com>
- Sender: news@zuni.esd.sgi.com (Net News)
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Lines: 45
-
- In <1992Dec24.011451.497@pixar.com> aaa@pixar.com (Tony Apodaca) writes:
-
- | In an article, svec5@menudo.uh.edu (T.C. Zhao) writes:
- | >| It appears that tempnam(3S) is broken on three MIPS machines I have
- | >| access to: IRIX 3.3, Ultrix 4.1, UMIPS 4.52:
- |
- | In an article, olson@anchor.esd.sgi.com (Dave Olson) writes:
- | >Since tempnam() needs to make sure the file it is existing doesn't
- | >exist, it isn't surprising that errno is set (but you shouldn't
- | >count on it either way!).
- |
- | In an article, murphy@ufp.dco.dec.com (Rick Murphy) writes:
- | >Looking at errno after calling a library routine that hasn't failed isn't
- | >a useful thing to do. The call succeeded - you've got no reason to go looking
- | >at errno.
- |
- | This is not really the point. The point is that a smart programmer
- | checks errno after every system call. So, at some point in your program,
-
- The *smart programmer*? First of all, tempnam() is *NOT* a system
- call on any version of unix I have ever used (although presumably
- somebody could make it one if they really wanted to do so), and
- second, *smart programmers* read the man pages. As Dave Anderson
- already pointed out (with chapter and verse from the standard),
- you aren't allowed to assume anything about errno unless the
- function/system call is spec'ed as doing something with it.
-
- Anybody who blindly checks errno is not smart, and just asking
- for trouble as underlying implementations change, either across
- vendors, or across releases from a single vendor.
-
- | Okay, maybe I'm exaggerating to make a point, but I don't think
- | it's fair to insinuate that Mr. Zhao is wrong. It *is* a bug, in the
- | following sense: the man pages explicitly state that errno is set if a
- | system call gets an error, but is untouched otherwise. I think library
- | utility functions fall into the "otherwise" category, don't you?
-
- No, you are completely wrong. Please go back and re-read
- Dave Anderson's response, or get a copy of the ANSI C standard
- and read it (which in this case, by the way, merely formalized
- something that has been true since at least V6 Unix).
- --
- Let no one tell me that silence gives consent, | Dave Olson
- because whoever is silent dissents. | Silicon Graphics, Inc.
- Maria Isabel Barreno | olson@sgi.com
-