macros.pl: be a bit more careful with open()
authorH. Peter Anvin <hpa@zytor.com>
Tue, 9 Sep 2008 16:43:16 +0000 (09:43 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 9 Sep 2008 16:43:16 +0000 (09:43 -0700)
Be a bit more strict with open() calls.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
macros.pl

index b1970cf5382cf4cb5ed89939b9dfc653720d88ac..165d09f7a49ed2030eb2f53b169d49aa3ffa64de 100755 (executable)
--- a/macros.pl
+++ b/macros.pl
@@ -37,7 +37,7 @@ sub charcify(@) {
 #
 # Generate macros.c
 #
-open(OUT,">macros.c") or die "unable to open macros.c\n";
+open(OUT,"> macros.c\0") or die "unable to open macros.c\n";
 
 print OUT "/*\n";
 print OUT " * Do not edit - this file auto-generated by macros.pl from:\n";
@@ -60,7 +60,7 @@ my $lastname;
 my $z;
 
 foreach $fname ( @ARGV ) {
-    open(INPUT,$fname) or die "unable to open $fname\n";
+    open(INPUT,"< $fname\0") or die "$0: $fname: $!\n";
     while (<INPUT>) {
        $line++;
        chomp;