Change 13904 by jhi@alpha on 2001/12/27 13:53:25
Subject: [PATCH] check return of close
From: [EMAIL PROTECTED] (Andreas J. Koenig)
Date: 27 Dec 2001 09:47:30 +0100
Message-ID: <[EMAIL PROTECTED]>
Subject: [PATCH] improve error reporting
From: [EMAIL PROTECTED] (Andreas J. Koenig)
Date: 27 Dec 2001 09:54:55 +0100
Message-ID: <[EMAIL PROTECTED]>
Subject: [PATCH] check return value of close
From: [EMAIL PROTECTED] (Andreas J. Koenig)
Date: 27 Dec 2001 10:03:55 +0100
Message-ID: <[EMAIL PROTECTED]>
Subject: [PATCH] return of close
From: [EMAIL PROTECTED] (Andreas J. Koenig)
Date: 27 Dec 2001 10:22:15 +0100
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/ext/IO/lib/IO/t/io_dir.t#3 edit
.... //depot/perl/lib/warnings.t#6 edit
.... //depot/perl/t/cmd/subval.t#7 edit
.... //depot/perl/t/io/fflush.t#4 edit
Differences ...
==== //depot/perl/ext/IO/lib/IO/t/io_dir.t#3 (xtext) ====
Index: perl/ext/IO/lib/IO/t/io_dir.t
--- perl/ext/IO/lib/IO/t/io_dir.t.~1~ Thu Dec 27 07:00:06 2001
+++ perl/ext/IO/lib/IO/t/io_dir.t Thu Dec 27 07:00:06 2001
@@ -41,7 +41,7 @@
open(FH,'>X') || die "Can't create x";
print FH "X";
-close(FH);
+close(FH) or die "Can't close: $!";
tie %dir, IO::Dir, $DIR;
my @files = keys %dir;
==== //depot/perl/lib/warnings.t#6 (text) ====
Index: perl/lib/warnings.t
--- perl/lib/warnings.t.~1~ Thu Dec 27 07:00:06 2001
+++ perl/lib/warnings.t Thu Dec 27 07:00:06 2001
@@ -1,4 +1,4 @@
-#!./perl
+#!./perl
BEGIN {
chdir 't' if -d 't';
@@ -33,13 +33,13 @@
open F, "<$file" or die "Cannot open $file: $!\n" ;
my $line = 0;
while (<F>) {
- $line++;
+ $line++;
last if /^__END__/ ;
}
{
local $/ = undef;
- $files++;
+ $files++;
@prgs = (@prgs, $file, split "\n########\n", <F>) ;
}
close F ;
@@ -48,13 +48,13 @@
undef $/;
print "1..", scalar(@prgs)-$files, "\n";
-
-
+
+
for (@prgs){
unless (/\n/)
{
- print "# From $_\n";
- next;
+ print "# From $_\n";
+ next;
}
my $switch = "";
my @temps = () ;
@@ -66,7 +66,7 @@
if ( $prog =~ /--FILE--/) {
my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ;
shift @files ;
- die "Internal error test $i didn't split into pairs, got " .
+ die "Internal error test $i didn't split into pairs, got " .
scalar(@files) . "[" . join("%%%%", @files) ."]\n"
if @files % 2 ;
while (@files > 2) {
@@ -75,21 +75,21 @@
push @temps, $filename ;
open F, ">$filename" or die "Cannot open $filename: $!\n" ;
print F $code ;
- close F ;
+ close F or die "Cannot close $filename: $!\n";
}
shift @files ;
$prog = shift @files ;
}
- open TEST, ">$tmpfile";
+ open TEST, ">$tmpfile" or die "Cannot open >$tmpfile: $!";
print TEST q{
- BEGIN {
- open(STDERR, ">&STDOUT")
+ BEGIN {
+ open(STDERR, ">&STDOUT")
or die "Can't dup STDOUT->STDERR: $!;";
}
};
print TEST "\n#line 1\n"; # So the line numbers don't get messed up.
print TEST $prog,"\n";
- close TEST;
+ close TEST or die "Cannot close $tmpfile: $!";
my $results = $Is_VMS ?
`./perl "-I../lib" $switch $tmpfile` :
$Is_MSWin32 ?
@@ -141,6 +141,6 @@
print "not ";
}
print "ok ", ++$i, "\n";
- foreach (@temps)
- { unlink $_ if $_ }
+ foreach (@temps)
+ { unlink $_ if $_ }
}
==== //depot/perl/t/cmd/subval.t#7 (xtext) ====
Index: perl/t/cmd/subval.t
--- perl/t/cmd/subval.t.~1~ Thu Dec 27 07:00:06 2001
+++ perl/t/cmd/subval.t Thu Dec 27 07:00:06 2001
@@ -114,14 +114,14 @@
$i = 28;
open(FOO,">Cmd_subval.tmp");
print FOO "blah blah\n";
-close FOO;
+close FOO or die "Can't close Cmd_subval.tmp: $!";
&file_main(*F);
-close F;
+close F or die "Can't close: $!";
&info_main;
&file_package(*F);
-close F;
+close F or die "Can't close: $!";
&info_package;
unlink 'Cmd_subval.tmp';
@@ -129,7 +129,7 @@
sub file_main {
local(*F) = @_;
- open(F, 'Cmd_subval.tmp') || die "can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "can't open: $!\n";
$i++;
eof F ? print "not ok $i\n" : print "ok $i\n";
}
@@ -137,11 +137,11 @@
sub info_main {
local(*F);
- open(F, 'Cmd_subval.tmp') || die "test: can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "test: can't open: $!\n";
$i++;
eof F ? print "not ok $i\n" : print "ok $i\n";
&iseof(*F);
- close F;
+ close F or die "Can't close: $!";
}
sub iseof {
@@ -156,7 +156,7 @@
sub main'file_package {
local(*F) = @_;
- open(F, 'Cmd_subval.tmp') || die "can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "can't open: $!\n";
$main'i++;
eof F ? print "not ok $main'i\n" : print "ok $main'i\n";
}
@@ -164,7 +164,7 @@
sub main'info_package {
local(*F);
- open(F, 'Cmd_subval.tmp') || die "can't open\n";
+ open(F, 'Cmd_subval.tmp') || die "can't open: $!\n";
$main'i++;
eof F ? print "not ok $main'i\n" : print "ok $main'i\n";
&iseof(*F);
==== //depot/perl/t/io/fflush.t#4 (text) ====
Index: perl/t/io/fflush.t
--- perl/t/io/fflush.t.~1~ Thu Dec 27 07:00:06 2001
+++ perl/t/io/fflush.t Thu Dec 27 07:00:06 2001
@@ -66,7 +66,7 @@
close OUT;
EOF
;
-close PROG;
+close PROG or die "close ff-prog: $!";;
push @delete, "ff-prog";
$| = 0; # we want buffered output
@@ -122,7 +122,7 @@
my $command = qq{$runperl "ff-prog" "$f" "rl"};
open OUT, "> $f" or die "open $f: $!";
print OUT "Pe";
- close OUT;
+ close OUT or die "close $f: $!";;
print "# $command\n";
$code->($command);
print file_eq($f, "Perl") ? "ok $t\n" : "not ok $t\n";
End of Patch.