X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCwd.pm;h=7f8ef6543b9ed0eda68135ef78ab4c5fa6a58be3;hb=6d80e9d0fed5aaa368313563b0a51ac19967da35;hp=d1ad76e9f110c2c775a6d5cf271b8f00ad493cb1;hpb=bde417e1a2abaeddb72f93c24d4b6f59f836872a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Cwd.pm b/lib/Cwd.pm index d1ad76e..7f8ef65 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -48,7 +48,7 @@ The cwd() is the most natural form for the current architecture. For most systems it is identical to `pwd` (but without the trailing line terminator). -Unfortunately, cwd() is B taint-safe. +Taint-safe. =item fastcwd @@ -105,7 +105,8 @@ Taint-safe. A more dangerous, but potentially faster version of abs_path. -B taint-safe. +This function is B taint-safe : you can't use it in programs +that work under taint mode. =back @@ -191,7 +192,16 @@ foreach my $try (qw(/bin/pwd /usr/bin/pwd)) { last; } } -$pwd_cmd ||= 'pwd'; +unless ($pwd_cmd) { + if (-x '/QOpenSys/bin/pwd') { # OS/400 PASE. + $pwd_cmd = '/QOpenSys/bin/pwd' ; + } else { + # Isn't this wrong? _backtick_pwd() will fail if somenone has + # pwd in their path but it is not /bin/pwd or /usr/bin/pwd? + # See [perl #16774]. --jhi + $pwd_cmd = 'pwd'; + } +} # The 'natural and safe form' for UNIX (pwd may be setuid root) sub _backtick_pwd { @@ -270,9 +280,9 @@ sub fastcwd { $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 =~ /^(.*)\z/s; # untaint - CORE::chdir($path) || return undef; + # Untaint it then check that we landed where we started. + $path =~ /^(.*)\z/s # untaint + && CORE::chdir($1) or return undef; ($cdev, $cino) = stat('.'); die "Unstable directory path, current directory changed unexpectedly" if $cdev != $orig_cdev || $cino != $orig_cino;