tools: Check for open return code in Perl scripts.
diff --git a/tools/winapi/config.pm b/tools/winapi/config.pm
index 58636df..b652e49 100644
--- a/tools/winapi/config.pm
+++ b/tools/winapi/config.pm
@@ -155,7 +155,7 @@
my @dirs = ($dir);
while(defined(my $dir = shift @dirs)) {
- opendir(DIR, $dir);
+ opendir(DIR, $dir) || die "Can't open directory $dir: $!\n";
my @entries= readdir(DIR);
closedir(DIR);
foreach (@entries) {
diff --git a/tools/winapi/make_filter b/tools/winapi/make_filter
index e427f8d..45665de 100755
--- a/tools/winapi/make_filter
+++ b/tools/winapi/make_filter
@@ -44,7 +44,7 @@
########################################################################
my $command = $options->make . " " . join(" ", $options->arguments);
-open(IN, "($command) 2>&1 |");
+open(IN, "($command) 2>&1 |") || die "Cannot execute command $command: $!";
while(<IN>) {
chomp;
diff --git a/tools/winapi/msvcmaker b/tools/winapi/msvcmaker
index 53c37fb..31bdc93 100755
--- a/tools/winapi/msvcmaker
+++ b/tools/winapi/msvcmaker
@@ -45,7 +45,7 @@
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 $lookahead = 0;
@@ -115,7 +115,7 @@
my %wine_test_dsp_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 $module;
diff --git a/tools/winapi/nativeapi.pm b/tools/winapi/nativeapi.pm
index 9f6a354..78b6ec9 100644
--- a/tools/winapi/nativeapi.pm
+++ b/tools/winapi/nativeapi.pm
@@ -59,7 +59,7 @@
$output->progress("$api_file");
- open(IN, "< $api_file");
+ open(IN, "< $api_file") || die "Error: Can't open $api_file: $!\n";
local $/ = "\n";
while(<IN>) {
s/^\s*(.*?)\s*$/$1/; # remove whitespace at begin and end of line
@@ -73,7 +73,7 @@
$output->progress("$configure_ac_file");
my $again = 0;
- open(IN, "< $configure_ac_file");
+ open(IN, "< $configure_ac_file") || die "Error: Can't open $configure_ac_file: $!\n";
local $/ = "\n";
while($again || (defined($_ = <IN>))) {
$again = 0;
@@ -141,7 +141,7 @@
$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";
while(<IN>) {
# remove leading and trailing whitespace
diff --git a/tools/winapi/winapi_check b/tools/winapi/winapi_check
index 89534d1..61a0635 100755
--- a/tools/winapi/winapi_check
+++ b/tools/winapi/winapi_check
@@ -82,7 +82,7 @@
$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>) {
if(/^\s*\#\s*include\s*\"(.*?)\"/) {
my $header = $1;
diff --git a/tools/winapi/winapi_extract b/tools/winapi/winapi_extract
index a11a91b..7c4a394 100755
--- a/tools/winapi/winapi_extract
+++ b/tools/winapi/winapi_extract
@@ -63,7 +63,7 @@
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 $lookahead = 0;
@@ -210,7 +210,7 @@
$progress_current++;
{
- open(IN, "< $file");
+ open(IN, "< $file") || die "Error: Can't open $file: $!\n";
local $/ = undef;
$_ = <IN>;
close(IN);
@@ -463,7 +463,7 @@
$spec_file .= "2";
$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})) {
my $function = $specifications{$module}{init}{function};
@@ -666,7 +666,7 @@
next if $external_name eq "\@";
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 "\n";
diff --git a/tools/winapi/winapi_fixup b/tools/winapi/winapi_fixup
index 2354723..334aa52 100755
--- a/tools/winapi/winapi_fixup
+++ b/tools/winapi/winapi_fixup
@@ -61,7 +61,7 @@
$output->prefix("$file:");
{
- open(IN, "< $file");
+ open(IN, "< $file") || die "Error: Can't open $file: $!\n";
local $/ = undef;
$_ = <IN>;
close(IN);
diff --git a/tools/winapi/winapi_module_user.pm b/tools/winapi/winapi_module_user.pm
index 0980085..ef14453 100644
--- a/tools/winapi/winapi_module_user.pm
+++ b/tools/winapi/winapi_module_user.pm
@@ -626,7 +626,7 @@
my $found_comment = shift;
{
- open(IN, "< $file");
+ open(IN, "< $file") || die "Error: Can't open $file: $!\n";
local $/ = undef;
$_ = <IN>;
close(IN);
diff --git a/tools/winapi/winapi_test b/tools/winapi/winapi_test
index 3e4b97e..db95c36 100755
--- a/tools/winapi/winapi_test
+++ b/tools/winapi/winapi_test
@@ -81,7 +81,7 @@
$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 @test_dirs = $tests->get_test_dirs();
@@ -337,7 +337,7 @@
$progress_current++;
{
- open(IN, "< $wine_dir/$file");
+ open(IN, "< $wine_dir/$file") || die "Error: Can't open $wine_dir/$file: $!\n";
local $/ = undef;
$_ = <IN>;
close(IN);