diff options
| -rw-r--r-- | scripts/kconfig/streamline_config.pl | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 62d64ce5c581..22b66cada779 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -171,8 +171,8 @@ sub read_kconfig { | |||
| 171 | $source =~ s/\$$env/$ENV{$env}/; | 171 | $source =~ s/\$$env/$ENV{$env}/; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | open(KIN, "$source") || die "Can't open $kconfig"; | 174 | open(my $kinfile, '<', $source) || die "Can't open $kconfig"; |
| 175 | while (<KIN>) { | 175 | while (<$kinfile>) { |
| 176 | chomp; | 176 | chomp; |
| 177 | 177 | ||
| 178 | # Make sure that lines ending with \ continue | 178 | # Make sure that lines ending with \ continue |
| @@ -249,7 +249,7 @@ sub read_kconfig { | |||
| 249 | $state = "NONE"; | 249 | $state = "NONE"; |
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | close(KIN); | 252 | close($kinfile); |
| 253 | 253 | ||
| 254 | # read in any configs that were found. | 254 | # read in any configs that were found. |
| 255 | foreach $kconfig (@kconfigs) { | 255 | foreach $kconfig (@kconfigs) { |
| @@ -293,8 +293,8 @@ foreach my $makefile (@makefiles) { | |||
| 293 | my $line = ""; | 293 | my $line = ""; |
| 294 | my %make_vars; | 294 | my %make_vars; |
| 295 | 295 | ||
| 296 | open(MIN,$makefile) || die "Can't open $makefile"; | 296 | open(my $infile, '<', $makefile) || die "Can't open $makefile"; |
| 297 | while (<MIN>) { | 297 | while (<$infile>) { |
| 298 | # if this line ends with a backslash, continue | 298 | # if this line ends with a backslash, continue |
| 299 | chomp; | 299 | chomp; |
| 300 | if (/^(.*)\\$/) { | 300 | if (/^(.*)\\$/) { |
| @@ -341,10 +341,11 @@ foreach my $makefile (@makefiles) { | |||
| 341 | } | 341 | } |
| 342 | } | 342 | } |
| 343 | } | 343 | } |
| 344 | close(MIN); | 344 | close($infile); |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | my %modules; | 347 | my %modules; |
| 348 | my $linfile; | ||
| 348 | 349 | ||
| 349 | if (defined($lsmod_file)) { | 350 | if (defined($lsmod_file)) { |
| 350 | if ( ! -f $lsmod_file) { | 351 | if ( ! -f $lsmod_file) { |
| @@ -354,13 +355,10 @@ if (defined($lsmod_file)) { | |||
| 354 | die "$lsmod_file not found"; | 355 | die "$lsmod_file not found"; |
| 355 | } | 356 | } |
| 356 | } | 357 | } |
| 357 | if ( -x $lsmod_file) { | 358 | |
| 358 | # the file is executable, run it | 359 | my $otype = ( -x $lsmod_file) ? '-|' : '<'; |
| 359 | open(LIN, "$lsmod_file|"); | 360 | open($linfile, $otype, $lsmod_file); |
| 360 | } else { | 361 | |
| 361 | # Just read the contents | ||
| 362 | open(LIN, "$lsmod_file"); | ||
| 363 | } | ||
| 364 | } else { | 362 | } else { |
| 365 | 363 | ||
| 366 | # see what modules are loaded on this system | 364 | # see what modules are loaded on this system |
| @@ -377,16 +375,16 @@ if (defined($lsmod_file)) { | |||
| 377 | $lsmod = "lsmod"; | 375 | $lsmod = "lsmod"; |
| 378 | } | 376 | } |
| 379 | 377 | ||
| 380 | open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod"; | 378 | open($linfile, '-|', $lsmod) || die "Can not call lsmod with $lsmod"; |
| 381 | } | 379 | } |
| 382 | 380 | ||
| 383 | while (<LIN>) { | 381 | while (<$linfile>) { |
| 384 | next if (/^Module/); # Skip the first line. | 382 | next if (/^Module/); # Skip the first line. |
| 385 | if (/^(\S+)/) { | 383 | if (/^(\S+)/) { |
| 386 | $modules{$1} = 1; | 384 | $modules{$1} = 1; |
| 387 | } | 385 | } |
| 388 | } | 386 | } |
| 389 | close (LIN); | 387 | close ($linfile); |
| 390 | 388 | ||
| 391 | # add to the configs hash all configs that are needed to enable | 389 | # add to the configs hash all configs that are needed to enable |
| 392 | # a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o | 390 | # a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o |
