tools: Check for open return code in Perl scripts.
This commit is contained in:
parent
22bc001c08
commit
ab2cdead77
|
@ -45,7 +45,7 @@ sub do_var($) {
|
||||||
$var =~ s/\t//g;
|
$var =~ s/\t//g;
|
||||||
return $var;
|
return $var;
|
||||||
}
|
}
|
||||||
open STDERR, ">&SAVEERR"; open STDERR, ">&STDOUT";
|
open(STDERR, ">&SAVEERR"); open(STDERR, ">&STDOUT");
|
||||||
$ENV{'SHELL'}="/bin/bash";
|
$ENV{'SHELL'}="/bin/bash";
|
||||||
my $var0 = qq{
|
my $var0 = qq{
|
||||||
What is your level of Wine expertise? 1-newbie 2-intermediate 3-advanced
|
What is your level of Wine expertise? 1-newbie 2-intermediate 3-advanced
|
||||||
|
@ -530,7 +530,7 @@ elsif ($outfile ne "no file" and $dbgoutfile eq "no file") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlink($tmpoutfile);
|
unlink($tmpoutfile);
|
||||||
open(OUTFILE, "$outfile");
|
open(OUTFILE, "$outfile") || die "Error: Can't open $outfile: $!\n";
|
||||||
while (<OUTFILE>) {
|
while (<OUTFILE>) {
|
||||||
$lastlines .= $_;
|
$lastlines .= $_;
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ else {
|
||||||
system("$wineloc WINEDEBUG=$debugopts $extraops \"$program\"");
|
system("$wineloc WINEDEBUG=$debugopts $extraops \"$program\"");
|
||||||
}
|
}
|
||||||
sub generate_outfile() {
|
sub generate_outfile() {
|
||||||
open(OUTFILE,">$outfile");
|
open(OUTFILE,">$outfile") || die "Error: Can't open $outfile: $!\n";
|
||||||
print OUTFILE <<EOM;
|
print OUTFILE <<EOM;
|
||||||
Auto-generated debug report by Wine Quick Debug Report Maker Tool:
|
Auto-generated debug report by Wine Quick Debug Report Maker Tool:
|
||||||
WINE Version: $winever
|
WINE Version: $winever
|
||||||
|
|
|
@ -22,7 +22,7 @@ use strict;
|
||||||
|
|
||||||
my @authors;
|
my @authors;
|
||||||
open(AUTHORS,"<AUTHORS") or die "Can't open AUTHORS";
|
open(AUTHORS,"<AUTHORS") or die "Can't open AUTHORS";
|
||||||
open(NEWAUTHORS,">AUTHORS.new");
|
open(NEWAUTHORS,">AUTHORS.new") or die "Can't open AUTHORS.new";
|
||||||
while(<AUTHORS>)
|
while(<AUTHORS>)
|
||||||
{
|
{
|
||||||
print NEWAUTHORS;
|
print NEWAUTHORS;
|
||||||
|
|
|
@ -155,7 +155,7 @@ sub _get_files($$;$) {
|
||||||
|
|
||||||
my @dirs = ($dir);
|
my @dirs = ($dir);
|
||||||
while(defined(my $dir = shift @dirs)) {
|
while(defined(my $dir = shift @dirs)) {
|
||||||
opendir(DIR, $dir);
|
opendir(DIR, $dir) || die "Can't open directory $dir: $!\n";
|
||||||
my @entries= readdir(DIR);
|
my @entries= readdir(DIR);
|
||||||
closedir(DIR);
|
closedir(DIR);
|
||||||
foreach (@entries) {
|
foreach (@entries) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ if($options->progress) {
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
my $command = $options->make . " " . join(" ", $options->arguments);
|
my $command = $options->make . " " . join(" ", $options->arguments);
|
||||||
open(IN, "($command) 2>&1 |");
|
open(IN, "($command) 2>&1 |") || die "Cannot execute command $command: $!";
|
||||||
|
|
||||||
while(<IN>) {
|
while(<IN>) {
|
||||||
chomp;
|
chomp;
|
||||||
|
|
|
@ -45,7 +45,7 @@ sub read_spec_file($) {
|
||||||
|
|
||||||
my $type = "win32";
|
my $type = "win32";
|
||||||
|
|
||||||
open(IN, "< $wine_dir/$spec_file");
|
open(IN, "< $wine_dir/$spec_file") || die "Error: Can't open $wine_dir/$spec_file: $!\n";
|
||||||
|
|
||||||
my $header = 1;
|
my $header = 1;
|
||||||
my $lookahead = 0;
|
my $lookahead = 0;
|
||||||
|
@ -115,7 +115,7 @@ sub filter_files($$) {
|
||||||
my %wine_test_dsp_files;
|
my %wine_test_dsp_files;
|
||||||
|
|
||||||
MAKEFILE_IN: foreach my $makefile_in_file (@makefile_in_files) {
|
MAKEFILE_IN: foreach my $makefile_in_file (@makefile_in_files) {
|
||||||
open(IN, "< $wine_dir/$makefile_in_file");
|
open(IN, "< $wine_dir/$makefile_in_file") || die "Error: Can't open $wine_dir/$makefile_in_file: $!\n";
|
||||||
|
|
||||||
my $topobjdir;
|
my $topobjdir;
|
||||||
my $module;
|
my $module;
|
||||||
|
|
|
@ -59,7 +59,7 @@ sub new($) {
|
||||||
|
|
||||||
$output->progress("$api_file");
|
$output->progress("$api_file");
|
||||||
|
|
||||||
open(IN, "< $api_file");
|
open(IN, "< $api_file") || die "Error: Can't open $api_file: $!\n";
|
||||||
local $/ = "\n";
|
local $/ = "\n";
|
||||||
while(<IN>) {
|
while(<IN>) {
|
||||||
s/^\s*(.*?)\s*$/$1/; # remove whitespace at begin and end of line
|
s/^\s*(.*?)\s*$/$1/; # remove whitespace at begin and end of line
|
||||||
|
@ -73,7 +73,7 @@ sub new($) {
|
||||||
$output->progress("$configure_ac_file");
|
$output->progress("$configure_ac_file");
|
||||||
|
|
||||||
my $again = 0;
|
my $again = 0;
|
||||||
open(IN, "< $configure_ac_file");
|
open(IN, "< $configure_ac_file") || die "Error: Can't open $configure_ac_file: $!\n";
|
||||||
local $/ = "\n";
|
local $/ = "\n";
|
||||||
while($again || (defined($_ = <IN>))) {
|
while($again || (defined($_ = <IN>))) {
|
||||||
$again = 0;
|
$again = 0;
|
||||||
|
@ -141,7 +141,7 @@ sub new($) {
|
||||||
|
|
||||||
$output->progress("$config_h_in_file");
|
$output->progress("$config_h_in_file");
|
||||||
|
|
||||||
open(IN, "< $config_h_in_file");
|
open(IN, "< $config_h_in_file") || die "Error: Can't open $config_h_in_file: $!\n";
|
||||||
local $/ = "\n";
|
local $/ = "\n";
|
||||||
while(<IN>) {
|
while(<IN>) {
|
||||||
# remove leading and trailing whitespace
|
# remove leading and trailing whitespace
|
||||||
|
|
|
@ -82,7 +82,7 @@ if ($options->global) {
|
||||||
|
|
||||||
$include2info{$file} = { name => $file };
|
$include2info{$file} = { name => $file };
|
||||||
|
|
||||||
open(IN, "< $wine_dir/$file");
|
open(IN, "< $wine_dir/$file") || die "Error: Can't open $wine_dir/$file: $!\n";
|
||||||
while(<IN>) {
|
while(<IN>) {
|
||||||
if(/^\s*\#\s*include\s*\"(.*?)\"/) {
|
if(/^\s*\#\s*include\s*\"(.*?)\"/) {
|
||||||
my $header = $1;
|
my $header = $1;
|
||||||
|
|
|
@ -63,7 +63,7 @@ if($options->spec_files || $options->winetest) {
|
||||||
|
|
||||||
my $type = "win32";
|
my $type = "win32";
|
||||||
|
|
||||||
open(IN, "< $wine_dir/$spec_file");
|
open(IN, "< $wine_dir/$spec_file") || die "Error: Can't open $wine_dir/$spec_file: $!\n";
|
||||||
|
|
||||||
my $header = 1;
|
my $header = 1;
|
||||||
my $lookahead = 0;
|
my $lookahead = 0;
|
||||||
|
@ -210,7 +210,7 @@ foreach my $file (@h_files, @c_files) {
|
||||||
$progress_current++;
|
$progress_current++;
|
||||||
|
|
||||||
{
|
{
|
||||||
open(IN, "< $file");
|
open(IN, "< $file") || die "Error: Can't open $file: $!\n";
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
$_ = <IN>;
|
$_ = <IN>;
|
||||||
close(IN);
|
close(IN);
|
||||||
|
@ -463,7 +463,7 @@ if($options->spec_files) {
|
||||||
$spec_file .= "2";
|
$spec_file .= "2";
|
||||||
|
|
||||||
$output->progress("$spec_file");
|
$output->progress("$spec_file");
|
||||||
open(OUT, "> $wine_dir/$spec_file");
|
open(OUT, "> $wine_dir/$spec_file") || die "Error: Can't open $wine_dir/$spec_file: $!\n";
|
||||||
|
|
||||||
if(exists($specifications{$module}{init})) {
|
if(exists($specifications{$module}{init})) {
|
||||||
my $function = $specifications{$module}{init}{function};
|
my $function = $specifications{$module}{init}{function};
|
||||||
|
@ -666,7 +666,7 @@ if($options->winetest) {
|
||||||
next if $external_name eq "\@";
|
next if $external_name eq "\@";
|
||||||
|
|
||||||
if($n == 0) {
|
if($n == 0) {
|
||||||
open(OUT, "> $wine_dir/programs/winetest/include/${package}.pm");
|
open(OUT, "> $wine_dir/programs/winetest/include/${package}.pm") || die "Error: Can't open $wine_dir/programs/winetest/include/${package}.pm: $!\n";
|
||||||
|
|
||||||
print OUT "package ${package};\n";
|
print OUT "package ${package};\n";
|
||||||
print OUT "\n";
|
print OUT "\n";
|
||||||
|
|
|
@ -61,7 +61,7 @@ foreach my $file (@c_files) {
|
||||||
$output->prefix("$file:");
|
$output->prefix("$file:");
|
||||||
|
|
||||||
{
|
{
|
||||||
open(IN, "< $file");
|
open(IN, "< $file") || die "Error: Can't open $file: $!\n";
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
$_ = <IN>;
|
$_ = <IN>;
|
||||||
close(IN);
|
close(IN);
|
||||||
|
|
|
@ -626,7 +626,7 @@ sub _parse_file($$$) {
|
||||||
my $found_comment = shift;
|
my $found_comment = shift;
|
||||||
|
|
||||||
{
|
{
|
||||||
open(IN, "< $file");
|
open(IN, "< $file") || die "Error: Can't open $file: $!\n";
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
$_ = <IN>;
|
$_ = <IN>;
|
||||||
close(IN);
|
close(IN);
|
||||||
|
|
|
@ -81,7 +81,7 @@ if (0) {
|
||||||
|
|
||||||
$file .= "2"; # FIXME: For tests
|
$file .= "2"; # FIXME: For tests
|
||||||
|
|
||||||
open(OUT, "> $winapi_dir/$file") || die "$winapi_dir/$file: $!\n";
|
open(OUT, "> $winapi_dir/$file") || die "Error: Can't open $winapi_dir/$file: $!\n";
|
||||||
|
|
||||||
my $x = 0;
|
my $x = 0;
|
||||||
my @test_dirs = $tests->get_test_dirs();
|
my @test_dirs = $tests->get_test_dirs();
|
||||||
|
@ -337,7 +337,7 @@ foreach my $file (@files) {
|
||||||
$progress_current++;
|
$progress_current++;
|
||||||
|
|
||||||
{
|
{
|
||||||
open(IN, "< $wine_dir/$file");
|
open(IN, "< $wine_dir/$file") || die "Error: Can't open $wine_dir/$file: $!\n";
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
$_ = <IN>;
|
$_ = <IN>;
|
||||||
close(IN);
|
close(IN);
|
||||||
|
|
|
@ -54,7 +54,7 @@ if (defined $usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $file (@files) {
|
foreach my $file (@files) {
|
||||||
open(IN, "< $file");
|
open(IN, "< $file") || die "Error: Can't open $file: $!\n";
|
||||||
|
|
||||||
my $level = 0;
|
my $level = 0;
|
||||||
my $extern_c = 0;
|
my $extern_c = 0;
|
||||||
|
|
Loading…
Reference in New Issue