Why does getpwd() have to chdir()?
Joe Wells
jbw at bucsf.bu.edu
Wed Oct 17 07:54:41 AEST 1990
In article <3554 at skye.ed.ac.uk> richard at aiai.ed.ac.uk (Richard Tobin) writes:
Why does getpwd() have to chdir()?
In most Unixes, there's a kernel limit of 1024 characters in a pathname.
If your current directory were located deep enough in the filesystem,
getcwd() couldn't make it all the way up to the root without chdir()-ing.
Of course, you understand how unlikely this is, but it is necessary for
the algorithm to be correct.
--
Joe Wells <jbw at bu.edu>
More information about the Comp.unix.programmer
mailing list