Eric E. Coe [Wed, 18 Oct 2000 04:03:54 +0000 (00:03 -0400)]
Subject: [ID
20001018.001] Fix for Cwd.pm (chroot)
Message-Id: <
39ED596A.70E599FE@oracle.com>
p4raw-id: //depot/perl@7358
# 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