diff options
author | Eric E. Coe <Eric.Coe@oracle.com> | 2000-10-18 00:03:54 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-10-18 17:03:15 +0000 |
commit | ea54c8bdf9458e2c187f15a2e52ca7cc0f735ef1 (patch) | |
tree | 7b8fbfaf9af822f754f4b0c6b63f9532bbf8c133 /lib | |
parent | fba9e08bdd5a995162402be33a34407318531d1a (diff) | |
download | perl-ea54c8bdf9458e2c187f15a2e52ca7cc0f735ef1.tar.gz |
Make Cwd more bulletproof in chrooted environments.
Subject: [ID 20001018.001] Fix for Cwd.pm (chroot)
Message-Id: <39ED596A.70E599FE@oracle.com>
p4raw-id: //depot/perl@7358
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Cwd.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm index dbeae69eb5..727959132c 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -89,7 +89,15 @@ sub _backtick_pwd { # Since some ports may predefine cwd internally (e.g., NT) # we take care not to override an existing definition for cwd(). -*cwd = \&_backtick_pwd unless defined &cwd; +unless(defined &cwd) { + # The pwd command is not available in some chroot(2)'ed environments + if(grep { -x "$_/pwd" } split(':', $ENV{PATH})) { + *cwd = \&_backtick_pwd; + } + else { + *cwd = \&getcwd; + } +} # By Brandon S. Allbery |