don’t use File::Temp because it’s Perl >= 5.6.1 only
spotted by RT
This commit is contained in:
parent
7cae22ef5c
commit
6e1ab32be6
33
check.pl
33
check.pl
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.pl,v 1.32 2013/07/21 18:35:56 tg Exp $
|
# $MirOS: src/bin/mksh/check.pl,v 1.33 2013/11/30 17:11:06 tg Exp $
|
||||||
# $OpenBSD: th,v 1.16 2013/06/14 20:52:08 millert Exp $
|
# $OpenBSD: th,v 1.16 2013/06/14 20:52:08 millert Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
|
||||||
@ -172,7 +172,6 @@ BEGIN {
|
|||||||
|
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
use Config;
|
use Config;
|
||||||
use File::Temp qw/ :mktemp /;
|
|
||||||
|
|
||||||
$os = defined $^O ? $^O : 'unknown';
|
$os = defined $^O ? $^O : 'unknown';
|
||||||
|
|
||||||
@ -251,7 +250,7 @@ die "$prog: no test set specified (use -s)\n" if !defined $opt_s;
|
|||||||
$test_prog = $opt_p;
|
$test_prog = $opt_p;
|
||||||
$verbose = defined $opt_v && $opt_v;
|
$verbose = defined $opt_v && $opt_v;
|
||||||
$test_set = $opt_s;
|
$test_set = $opt_s;
|
||||||
$temp_dir = $opt_T || "/tmp";
|
$temp_base = $opt_T || "/tmp";
|
||||||
if (defined $opt_t) {
|
if (defined $opt_t) {
|
||||||
die "$prog: bad -t argument (should be number > 0): $opt_t\n"
|
die "$prog: bad -t argument (should be number > 0): $opt_t\n"
|
||||||
if $opt_t !~ /^\d+$/ || $opt_t <= 0;
|
if $opt_t !~ /^\d+$/ || $opt_t <= 0;
|
||||||
@ -300,6 +299,18 @@ chop($pwd = `pwd 2>/dev/null`);
|
|||||||
die "$prog: couldn't get current working directory\n" if $pwd eq '';
|
die "$prog: couldn't get current working directory\n" if $pwd eq '';
|
||||||
die "$prog: couldn't cd to $pwd - $!\n" if !chdir($pwd);
|
die "$prog: couldn't cd to $pwd - $!\n" if !chdir($pwd);
|
||||||
|
|
||||||
|
die "$prog: couldn't cd to $temp_base - $!\n" if !chdir($temp_base);
|
||||||
|
die "$prog: couldn't get temporary directory base\n" unless -d '.';
|
||||||
|
$temps = sprintf("chk%d-%d.", $$, time());
|
||||||
|
$tempi = 0;
|
||||||
|
until (mkdir(($tempdir = sprintf("%s%03d", $temps, $tempi)), 0700)) {
|
||||||
|
die "$prog: couldn't get temporary directory\n" if $tempi++ >= 999;
|
||||||
|
}
|
||||||
|
die "$prog: couldn't cd to $tempdir - $!\n" if !chdir($tempdir);
|
||||||
|
chop($temp_dir = `pwd 2>/dev/null`);
|
||||||
|
die "$prog: couldn't get temporary directory\n" if $temp_dir eq '';
|
||||||
|
die "$prog: couldn't cd to $pwd - $!\n" if !chdir($pwd);
|
||||||
|
|
||||||
if (!$program_kludge) {
|
if (!$program_kludge) {
|
||||||
$test_prog = "$pwd/$test_prog" if substr($test_prog, 0, 1) ne '/';
|
$test_prog = "$pwd/$test_prog" if substr($test_prog, 0, 1) ne '/';
|
||||||
die "$prog: $test_prog is not executable - bye\n"
|
die "$prog: $test_prog is not executable - bye\n"
|
||||||
@ -314,15 +325,12 @@ $SIG{'ALRM'} = 'catch_sigalrm';
|
|||||||
$| = 1;
|
$| = 1;
|
||||||
|
|
||||||
# Create temp files
|
# Create temp files
|
||||||
($fh, $temps) = mkstemp("${temp_dir}/rts.XXXXXXXX");
|
$temps = "${temp_dir}/rts";
|
||||||
close($fh);
|
$tempi = "${temp_dir}/rti";
|
||||||
($fh, $tempi) = mkstemp("${temp_dir}/rti.XXXXXXXX");
|
$tempo = "${temp_dir}/rto";
|
||||||
close($fh);
|
$tempe = "${temp_dir}/rte";
|
||||||
($fh, $tempo) = mkstemp("${temp_dir}/rto.XXXXXXXX");
|
$tempdir = "${temp_dir}/rtd";
|
||||||
close($fh);
|
mkdir($tempdir, 0700) or die "$prog: couldn't mkdir $tempdir - $!\n";
|
||||||
($fh, $tempe) = mkstemp("${temp_dir}/rte.XXXXXXXX");
|
|
||||||
close($fh);
|
|
||||||
$tempdir = mkdtemp("${temp_dir}/rtd.XXXXXXXX");
|
|
||||||
|
|
||||||
if (-d $test_set) {
|
if (-d $test_set) {
|
||||||
$file_prefix_skip = length($test_set) + 1;
|
$file_prefix_skip = length($test_set) + 1;
|
||||||
@ -365,6 +373,7 @@ cleanup_exit
|
|||||||
unlink($tempi, $tempo, $tempe, $temps);
|
unlink($tempi, $tempo, $tempe, $temps);
|
||||||
&scrub_dir($tempdir) if defined $tempdir;
|
&scrub_dir($tempdir) if defined $tempdir;
|
||||||
rmdir($tempdir) if defined $tempdir;
|
rmdir($tempdir) if defined $tempdir;
|
||||||
|
rmdir($temp_dir) if defined $temp_dir;
|
||||||
|
|
||||||
if ($sig) {
|
if ($sig) {
|
||||||
$SIG{$sig} = 'DEFAULT';
|
$SIG{$sig} = 'DEFAULT';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user