summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2001-11-06 22:45:01 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-07 01:22:40 +0000
commita384e9e1be3de1dac7ce4a6952ba555727054ca7 (patch)
tree410c07192354d653062e716e6118cde5a8c90d70 /lib/File
parent3e90d5a3156f71fc1a63780fe898a92da05fc766 (diff)
downloadperl-a384e9e1be3de1dac7ce4a6952ba555727054ca7.tar.gz
a bunch of untested patches
Message-ID: <20011106214501.A704@rafael> p4raw-id: //depot/perl@12879
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/Spec/OS2.pm10
-rw-r--r--lib/File/Spec/VMS.pm13
-rw-r--r--lib/File/Spec/Win32.pm13
3 files changed, 33 insertions, 3 deletions
diff --git a/lib/File/Spec/OS2.pm b/lib/File/Spec/OS2.pm
index 20bf8c9dce..6392ba4acb 100644
--- a/lib/File/Spec/OS2.pm
+++ b/lib/File/Spec/OS2.pm
@@ -33,7 +33,15 @@ my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
my $self = shift;
- foreach (@ENV{qw(TMPDIR TEMP TMP)}, qw(/tmp /)) {
+ my @dirlist = ( @ENV{qw(TMPDIR TEMP TMP)}, qw(/tmp /) );
+ {
+ no strict 'refs';
+ if (${"\cTAINT"}) { # Check for taint mode on perl >= 5.8.0
+ require Scalar::Util;
+ @dirlist = grep { ! Scalar::Util::tainted $_ } @dirlist;
+ }
+ }
+ foreach (@dirlist) {
next unless defined && -d;
$tmpdir = $_;
last;
diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm
index 184c827815..325af08290 100644
--- a/lib/File/Spec/VMS.pm
+++ b/lib/File/Spec/VMS.pm
@@ -269,12 +269,23 @@ from the following list or '' if none are writable:
sys$scratch:
$ENV{TMPDIR}
+Since perl 5.8.0, if running under taint mode, and if $ENV{TMPDIR}
+is tainted, it is not used.
+
=cut
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
- foreach ('sys$scratch:', $ENV{TMPDIR}) {
+ my @dirlist = ('sys$scratch:', $ENV{TMPDIR});
+ {
+ no strict 'refs';
+ if (${"\cTAINT"}) { # Check for taint mode on perl >= 5.8.0
+ require Scalar::Util;
+ pop @dirlist if Scalar::Util::tainted($ENV{TMPDIR});
+ }
+ }
+ foreach (@dirlist) {
next unless defined && -d && -w _;
$tmpdir = $_;
last;
diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm
index 519fb86e82..d2e94bc98c 100644
--- a/lib/File/Spec/Win32.pm
+++ b/lib/File/Spec/Win32.pm
@@ -47,13 +47,24 @@ from the following list:
/tmp
/
+Since perl 5.8.0, if running under taint mode, and if the environment
+variables are tainted, they are not used.
+
=cut
my $tmpdir;
sub tmpdir {
return $tmpdir if defined $tmpdir;
my $self = shift;
- foreach (@ENV{qw(TMPDIR TEMP TMP)}, qw(C:/temp /tmp /)) {
+ my @dirlist = (@ENV{qw(TMPDIR TEMP TMP)}, qw(C:/temp /tmp /));
+ {
+ no strict 'refs';
+ if (${"\cTAINT"}) { # Check for taint mode on perl >= 5.8.0
+ require Scalar::Util;
+ @dirlist = grep { ! Scalar::Util::tainted $_ } @dirlist;
+ }
+ }
+ foreach (@dirlist) {
next unless defined && -d;
$tmpdir = $_;
last;