home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sun / admin / 9342 < prev    next >
Encoding:
Internet Message Format  |  1992-12-11  |  1.6 KB

  1. Xref: sparky comp.sys.sun.admin:9342 comp.sys.sun.misc:5810
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!wupost!cs.utexas.edu!asuvax!ncar!hsdndev!news.cs.umb.edu!rouilj
  3. From: rouilj@dl5000.bc.edu (John P. Rouillard)
  4. Newsgroups: comp.sys.sun.admin,comp.sys.sun.misc
  5. Subject: Re: problems with pathnames on automounted systems
  6. Message-ID: <ROUILJ.92Dec11155326@dl5000.bc.edu>
  7. Date: 11 Dec 92 20:53:26 GMT
  8. References: <ByLrGL.FAs@cs.bham.ac.uk> <1992Dec2.204641.1149@zia.aoc.nrao.edu>
  9.     <BypHr4.Crz@cs.bham.ac.uk> <DERAADT.92Dec5150443@newt.newt.cuc.ab.ca>
  10. Sender: news@cs.umb.edu (USENET News System)
  11. Organization: Institute for Space Research, Boston College
  12. Lines: 26
  13. In-Reply-To: deraadt@newt.cuc.ab.ca's message of 5 Dec 92 22: 04:43 GMT
  14. Nntp-Posting-Host: dl5000.bc.edu
  15.  
  16.  
  17. In article <DERAADT.92Dec5150443@newt.newt.cuc.ab.ca> deraadt@newt.cuc.ab.ca (Theo de Raadt) writes:
  18.  
  19. >    In a program we have that needs to know what the real(TM) directory path
  20. >    is, I follow this scheme....
  21. >        char cwd[MAXPATHLEN];
  22. >        char *s;
  23. >        getcwd(cwd, sizeof cwd)
  24. >        if( (s=getenv("PWD")) != NULL)
  25. >            strncpy(cwd, s, sizeof cwd);
  26. >    Many modern shells will also export the variable $cwd into $PWD. There's
  27. >    no better way to deal with it at the moment.
  28. >     <tdr.
  29.  
  30.  
  31. Well, I would also check the inode, and device numbers before relying
  32. on $PWD. I have seen $PWD get out of sync on occasion.
  33.  
  34. Also, if you run the AMD automounter, you can just query the
  35. automounter and use the info from the automounter to construct the
  36. logical directory path. It really works quite well.
  37.  
  38. -- John
  39.