X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCwd.pm;h=df40649a427f9261f6dbfeafd9b0fc363aedd188;hb=054b02d6604bb3beeebed2d8a040d025b131c9a6;hp=64798da00f556c049532b4f44143f6036a7e1806;hpb=20408e3ccf502b6ce4033d8203710405ec9ef8f6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 64798da..df40649 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -32,7 +32,7 @@ The getcwd() function re-implements the getcwd(3) (or getwd(3)) functions in Perl. The abs_path() function takes a single argument and returns the -absolute pathname for that argument. It uses the same algoritm as +absolute pathname for that argument. It uses the same algorithm as getcwd(). (actually getcwd() is abs_path(".")) The fastcwd() function looks the same as getcwd(), but runs faster. @@ -118,7 +118,7 @@ sub fastcwd { for (;;) { my $direntry; ($odev, $oino) = ($cdev, $cino); - chdir('..') || return undef; + CORE::chdir('..') || return undef; ($cdev, $cino) = stat('.'); last if $odev == $cdev && $oino == $cino; opendir(DIR, '.') || return undef; @@ -136,10 +136,11 @@ sub fastcwd { unshift(@path, $direntry); } $path = '/' . join('/', @path); + if ($^O eq 'apollo') { $path = "/".$path; } # At this point $path may be tainted (if tainting) and chdir would fail. # To be more useful we untaint it then check that we landed where we started. $path = $1 if $path =~ /^(.*)$/; # untaint - chdir($path) || return undef; + CORE::chdir($path) || return undef; ($cdev, $cino) = stat('.'); die "Unstable directory path, current directory changed unexpectedly" if $cdev != $orig_cdev || $cino != $orig_cino; @@ -208,6 +209,8 @@ sub abs_path my $start = @_ ? shift : '.'; my($dotdots, $cwd, @pst, @cst, $dir, @tst); + return cwd() if ( $^O =~ /cygwin/ ); + unless (@cst = stat( $start )) { carp "stat($start): $!"; @@ -259,9 +262,9 @@ sub abs_path sub fast_abs_path { my $cwd = getcwd(); my $path = shift || '.'; - chdir($path) || croak "Cannot chdir to $path:$!"; + CORE::chdir($path) || croak "Cannot chdir to $path:$!"; my $realpath = getcwd(); - chdir($cwd) || croak "Cannot chdir back to $cwd:$!"; + CORE::chdir($cwd) || croak "Cannot chdir back to $cwd:$!"; $realpath; } @@ -269,7 +272,7 @@ sub fast_abs_path { # --- PORTING SECTION --- # VMS: $ENV{'DEFAULT'} points to default directory at all times -# 06-Mar-1996 Charles Bailey bailey@genetics.upenn.edu +# 06-Mar-1996 Charles Bailey bailey@newman.upenn.edu # Note: Use of Cwd::chdir() causes the logical name PWD to be defined # in the process logical name table as the default device and directory # seen by Perl. This may not be the same as the default device