Commit bae4cecc authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Michal Marek

headers_install: use local file handles

Better practice to use 3 arg open and local file handles.
Signed-off-by: default avatarStephen Hemminger <>
Acked-by: default avatarWANG Cong <>
Cc: Michal Marek <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarMichal Marek <>
parent dbbe33e9
......@@ -23,13 +23,13 @@ my ($readdir, $installdir, $arch, @files) = @ARGV;
my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
foreach my $file (@files) {
local *INFILE;
local *OUTFILE;
my $tmpfile = "$installdir/$file.tmp";
open(INFILE, "<$readdir/$file")
open(my $in, '<', "$readdir/$file")
or die "$readdir/$file: $!\n";
open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
while (my $line = <INFILE>) {
open(my $out, '>', $tmpfile)
or die "$tmpfile: $!\n";
while (my $line = <$in>) {
$line =~ s/([\s(])__user\s/$1/g;
$line =~ s/([\s(])__force\s/$1/g;
$line =~ s/([\s(])__iomem\s/$1/g;
......@@ -39,10 +39,11 @@ foreach my $file (@files) {
$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
printf OUTFILE "%s", $line;
printf {$out} "%s", $line;
close OUTFILE;
close INFILE;
close $out;
close $in;
system $unifdef . " $tmpfile > $installdir/$file";
unlink $tmpfile;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment