From: Nicholas Clark Date: Mon, 28 Feb 2011 15:17:17 +0000 (+0000) Subject: Convert the taint.t Fcntl tests to use tempfile(), instead of "foo". X-Git-Tag: accepted/trunk/20130322.191538~5251 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=281a340fc9949f59cf3ae61917913b16c8924ce1;p=platform%2Fupstream%2Fperl.git Convert the taint.t Fcntl tests to use tempfile(), instead of "foo". tempfile() also automatically deletes all of its temporary files. --- diff --git a/t/op/taint.t b/t/op/taint.t index a940493..7dcc937 100644 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -1469,7 +1469,8 @@ SKIP: { SKIP: { skip "no Fcntl", 18 unless $has_fcntl; - my $evil = "foo" . $TAINT; + my $foo = tempfile(); + my $evil = $foo . $TAINT; eval { sysopen(my $ro, $evil, &O_RDONLY) }; test $@ !~ /^Insecure dependency/, $@; @@ -1489,43 +1490,41 @@ SKIP: { eval { sysopen(my $tr, $evil, &O_TRUNC) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $ro, "foo", &O_RDONLY | $TAINT0) }; + eval { sysopen(my $ro, $foo, &O_RDONLY | $TAINT0) }; test $@ !~ /^Insecure dependency/, $@; - eval { sysopen(my $wo, "foo", &O_WRONLY | $TAINT0) }; + eval { sysopen(my $wo, $foo, &O_WRONLY | $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $rw, "foo", &O_RDWR | $TAINT0) }; + eval { sysopen(my $rw, $foo, &O_RDWR | $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $ap, "foo", &O_APPEND | $TAINT0) }; + eval { sysopen(my $ap, $foo, &O_APPEND | $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $cr, "foo", &O_CREAT | $TAINT0) }; + eval { sysopen(my $cr, $foo, &O_CREAT | $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $tr, "foo", &O_TRUNC | $TAINT0) }; + eval { sysopen(my $tr, $foo, &O_TRUNC | $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $ro, "foo", &O_RDONLY, $TAINT0) }; + eval { sysopen(my $ro, $foo, &O_RDONLY, $TAINT0) }; test $@ !~ /^Insecure dependency/, $@; - eval { sysopen(my $wo, "foo", &O_WRONLY, $TAINT0) }; + eval { sysopen(my $wo, $foo, &O_WRONLY, $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $rw, "foo", &O_RDWR, $TAINT0) }; + eval { sysopen(my $rw, $foo, &O_RDWR, $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $ap, "foo", &O_APPEND, $TAINT0) }; + eval { sysopen(my $ap, $foo, &O_APPEND, $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $cr, "foo", &O_CREAT, $TAINT0) }; + eval { sysopen(my $cr, $foo, &O_CREAT, $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - eval { sysopen(my $tr, "foo", &O_TRUNC, $TAINT0) }; + eval { sysopen(my $tr, $foo, &O_TRUNC, $TAINT0) }; test $@ =~ /^Insecure dependency/, $@; - - unlink("foo"); # not unlink($evil), because that would fail... } }