getting the current working directory

Brian Matthews 6sigma2 at polari.UUCP
Sun Jan 13 06:27:30 AEST 1991


In article <5195 at idunno.Princeton.EDU> pfalstad at phoenix.Princeton.EDU (Paul John Falstad) writes:
|Here is a version of getwd I wrote for zsh.  I'd be interested in what
|people think of it.  I needed a version that didn't fork(), and was
|having problems with the Sun getwd().

[getwd that crawls up the directory tree reading each directory on the way]

The problem with this is that it's quite possible to be in a directory
which has some ancestors that can't be read.  Thus a program calling this
getwd must be running setuid root or in a restricted environment (in which
case it probably shouldn't need to call getwd) where it knows all ancestors
of the current directory are readable.
-- 
Brian L. Matthews	6sigma2 at polari.UUCP



More information about the Comp.unix.programmer mailing list