Why use pwd(1) for getpwd(3C)? (Re: Why use find?)

Kim Christian Madsen kimcm at diku.dk
Thu Oct 11 11:26:43 AEST 1990


brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:

>In article <1990Oct9.122813.1329 at cbnews.att.com> jbr0 at cbnews.att.com (joseph.a.brownlee) writes:
>  [ why is getpwd() implemented as `pwd` in System V? ]

>Because there's no getwd() system call to have the kernel do the job.
>Unless you have some sort of privileges, you won't be able to figure
>out the current directory when any higher directory is unreadable.

That's maybe the indirect reason, the rest is because of sloppy AT&T
programmers, that figured that there was no reason to copy code from
pwd(1) into the getpwd(3C) routine. SYSVR4 is supposed to eliminate this
idiotic behaviour of getpwd(3C), and I pray that AT&T have learned from
the negative response they have got, and do not try this path again.


As a sidenote, Doug Gwyn released a PD getpwd(3C) routine some time ago,
that behave as supposed. Check source archives for the source.

				Regards,
				Kim Chr. Madsen



More information about the Comp.unix.programmer mailing list