home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.31 / text0091.txt < prev    next >
Encoding:
Text File  |  1993-07-15  |  1.5 KB  |  52 lines

  1. Submitted-by: ericb@sierra.com (Eric Blood)
  2.  
  3. After going over pathconf(), I need something clarified.
  4.  
  5. In the Posix 1003.1 (90) document the return for pathconf is
  6. documented as follows:
  7.  
  8. "If 'name' is an invalid value, the pathconf() and fpathconf() functions
  9. shall return -1.
  10.  
  11. "If the variable corresponding to 'name' has no limit for that path or
  12. file descriptor, the pathconf() and fpathconf() functions shall return
  13. -1 without changing errno."
  14.  
  15. I have always gone on the assumption that you are never supposed to
  16. set errno.  However, if it is allowed, then pathconf() could be used
  17. as defined.  For example:
  18.  
  19. ...
  20. errno = 0;
  21. if ((foo = pathconf("/tmp/bar", _PC_LINK_MAX)) < 0) {
  22.   if (errno == 0) {
  23.     ... /* No limit */
  24.   } else {
  25.     ... /* Invalid argument */
  26.   }
  27. } else {
  28.   ... /* foo contains a valid limit */
  29. }
  30. ...
  31.  
  32. The documentation for errno (in the same document) is as follows:
  33.  
  34. "The value of this variable ['errno'] shall be defined only after a
  35. call to a function for which it is explicitly stated to be set and
  36. until it is changed by the next function call.  The variable 'errno'
  37. should only be examined when it is indicated to be valid by a
  38. function's return value.  No function defined in this part of ISO/IEC
  39. 9945 sets errno to zero to indicate an error."
  40.  
  41. Does this mean I'm allowed to set the errno variable or not?  If I'm
  42. able to, then I can use the example code with pathconf().  Otherwise,
  43. what should I do?
  44.  
  45. -- 
  46. Eric V. Blood
  47. ericb@sierra.com
  48.  
  49.  
  50. Volume-Number: Volume 31, Number 93
  51.  
  52.