home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: ericb@sierra.com (Eric Blood)
-
- After going over pathconf(), I need something clarified.
-
- In the Posix 1003.1 (90) document the return for pathconf is
- documented as follows:
-
- "If 'name' is an invalid value, the pathconf() and fpathconf() functions
- shall return -1.
-
- "If the variable corresponding to 'name' has no limit for that path or
- file descriptor, the pathconf() and fpathconf() functions shall return
- -1 without changing errno."
-
- I have always gone on the assumption that you are never supposed to
- set errno. However, if it is allowed, then pathconf() could be used
- as defined. For example:
-
- ...
- errno = 0;
- if ((foo = pathconf("/tmp/bar", _PC_LINK_MAX)) < 0) {
- if (errno == 0) {
- ... /* No limit */
- } else {
- ... /* Invalid argument */
- }
- } else {
- ... /* foo contains a valid limit */
- }
- ...
-
- The documentation for errno (in the same document) is as follows:
-
- "The value of this variable ['errno'] shall be defined only after a
- call to a function for which it is explicitly stated to be set and
- until it is changed by the next function call. The variable 'errno'
- should only be examined when it is indicated to be valid by a
- function's return value. No function defined in this part of ISO/IEC
- 9945 sets errno to zero to indicate an error."
-
- Does this mean I'm allowed to set the errno variable or not? If I'm
- able to, then I can use the example code with pathconf(). Otherwise,
- what should I do?
-
- --
- Eric V. Blood
- ericb@sierra.com
-
-
- Volume-Number: Volume 31, Number 93
-
-