home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!mdisea!mitchell
- From: mitchell@mdd.comm.mot.com (Bill Mitchell)
- Subject: errno (was Re: Too many open files)
- Message-ID: <1992Aug27.142224.9152@mdd.comm.mot.com>
- Sender: news@mdd.comm.mot.com
- Bcc: mitchell
- Reply-To: mitchell@mdd.comm.mot.com (Bill Mitchell)
- Organization: Motorola, Mobile Data Division - Seattle, WA
- References: <28622@vedge.UUCP> <1992Aug27.065803.28247@klaava.Helsinki.FI>
- Date: Thu, 27 Aug 1992 14:22:24 GMT
- Lines: 39
-
- in comp.lang.c, wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) said:
-
-
- >michel@vedge.UUCP (Michel Trudeau) writes:
- >> [* fopen fails, some compilers set errno, some don't *]
- >
- >Yes. There is no guarantee that fopen set errno to anything at all.
- >
- >--
- >Lars.Wirzenius@helsinki.fi
-
- That's the bottom line, but a bit terse. Let me expand a bit, reading
- from PJP's book The Standard C Library:
-
- Page 50, Using <errno.h> starts out:
-
- "The C Standard leaves much unsaid about the errors that can be reported.
- It says even less about the values of any error codes [.....] Even different
- versions of UNIX define dirrerent sets of error codes. If you are writing
- code for a specific system you may have to learn its peculiar set of error
- codes. List the header <errno.h> if you can. [...]"
-
- In section 7.1.14, the standard says, "The value of errno is zero at program
- startup, but it is never set to zero by any library function. The value of
- errno may be set to nonzero by a library function call whether or not there
- is an error, provided the use of errno is not documented in the description
- of the function in this International Standard."
-
- Section 7.9.5.3, on the fopen function, does not document the use of errno
- by fopen.
-
- So, there is no guarantee that fopen set errno to anything at all, but
- it is allowed to set errno to any nonzero value whether or not there
- was an error. See implementation-specific documentation for implementation-
- specific details.
-
- --
- mitchell@mdd.comm.mot.com (Bill Mitchell)
-
-