home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / sgi / 18338 < prev    next >
Encoding:
Internet Message Format  |  1992-12-25  |  2.8 KB

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