Path: utzoo!attcan!uunet!samsung!dali.cs.montana.edu!uakari.primate.wisc.edu!sdd.hp.com!decwrl!shelby!neon!Gang-of-Four!dkeisen From: dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) Newsgroups: comp.unix.programmer Subject: Re: Why use pwd(1) for getpwd(3C)? (Re: Why use find?) Message-ID: <1990Oct11.165733.17946@Neon.Stanford.EDU> Date: 11 Oct 90 16:57:33 GMT References: <1990Oct10.231857.11668@virtech.uucp> <14976@hydra.gatech.EDU> Sender: news@Neon.Stanford.EDU (USENET News System) Organization: Sequoia Peripherals Lines: 24 in article <1990Oct10.231857.11668@virtech.uucp>, cpcahil@virtech.uucp (Conor P. Cahill) says: > I don't know the reason for making it a call to popen(), one reason may > have been security (pwd could be a setuid pgm and do things that a > function call couldn't). Another possibility is pointed up by the snippet from our man page for getwd: * Getwd changes directories (uses the system call chdir) to figure out which directory you are in. If there is an error, getwd may not be able to change back to the directory you were in when you called it. If this occurs, any files created will be in the wrong place. Or what if the permissions on your current directory have changed since it became your current directory and you can't chdir back to it? These problems go away if getwd is done by a different process. -- Dave Eisen Home: (415) 323-9757 dkeisen@Gang-of-Four.Stanford.EDU Office: (415) 967-5644 1447 N. Shoreline Blvd. Mountain View, CA 94043