home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sgi:18225 comp.sys.sgi.bugs:23 comp.unix.ultrix:8985
- Newsgroups: comp.sys.sgi,comp.sys.sgi.bugs,comp.unix.ultrix
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!saimiri.primate.wisc.edu!ames!sgi!fido!zola!zuni!anchor!olson
- From: olson@anchor.esd.sgi.com (Dave Olson)
- Subject: Re: tempnam(3S) bug, possibly on all MIPS
- Message-ID: <tqcnepk@zuni.esd.sgi.com>
- Sender: news@zuni.esd.sgi.com (Net News)
- Organization: Silicon Graphics, Inc. Mountain View, CA
- References: <1gu849INNp6k@menudo.uh.edu>
- Date: Sat, 19 Dec 92 22:17:00 GMT
- Lines: 33
-
- In <1gu849INNp6k@menudo.uh.edu> 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:
- |
- | /*
- | * check to see if tempnam has the errno bug.
- | */
- | #include <stdio.h>
- | #include <stdlib.h>
- | #include <unistd.h>
- | #include <errno.h>
- |
- | int main(int argc, char **argv)
- | {
- | char *p;
- | errno = 0;
- | p = tempnam(0, 0);
- | if(errno) fprintf(stderr," tempnam is broken\n");
- | return 0;
- | }
-
- It isn't a bug. The bug is in your code. errno is only supposed
- to be tested after failures of system calls or other library
- routines that document that they set errno on failure.
-
- 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!).
- --
- 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
-