develooper Front page | perl.perl5.porters | Postings from March 2000

[PATCH 5.5.670] Cwd.pm cleanup

From:
Greg Bacon
Date:
March 1, 2000 08:58
Subject:
[PATCH 5.5.670] Cwd.pm cleanup
Message ID:
200003011706.LAA23355@ruby.itsc.uah.edu
--- perl-5.5.670.dist/lib/Cwd.pm	Wed Feb  2 01:49:07 2000
+++ perl-5.5.670/lib/Cwd.pm	Wed Mar  1 11:05:13 2000
@@ -142,7 +142,7 @@
     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
+    $path = $1 if $path =~ /^(.*)\z/s;	# untaint
     CORE::chdir($path) || return undef;
     ($cdev, $cino) = stat('.');
     die "Unstable directory path, current directory changed unexpectedly"
@@ -170,7 +170,7 @@
 	$ENV{'PWD'} = cwd();
     }
     # Strip an automounter prefix (where /tmp_mnt/foo/bar == /foo/bar)
-    if ($ENV{'PWD'} =~ m|(/[^/]+(/[^/]+/[^/]+))(.*)|) {
+    if ($ENV{'PWD'} =~ m|(/[^/]+(/[^/]+/[^/]+))(.*)|s) {
 	my($pd,$pi) = stat($2);
 	my($dd,$di) = stat($1);
 	if (defined $pd and defined $dd and $di == $pi and $dd == $pd) {
@@ -187,7 +187,7 @@
     return 0 unless CORE::chdir $newdir;
     if ($^O eq 'VMS') { return $ENV{'PWD'} = $ENV{'DEFAULT'} }
 
-    if ($newdir =~ m#^/#) {
+    if ($newdir =~ m#^/#s) {
 	$ENV{'PWD'} = $newdir;
     } else {
 	my @curdir = split(m#/#,$ENV{'PWD'});
End of Patch.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About