Switch all calls to open() to explicitly open for read

This commit is contained in:
Jamie Cameron
2020-03-14 17:20:54 -07:00
parent 3093838b5b
commit a2dc3f7124
248 changed files with 548 additions and 552 deletions

View File

@@ -43,7 +43,7 @@ return 1; # same!
sub read_shorewall6_config
{
local @ret;
open(SHOREWALL_CONF, "$config{'config_dir'}/shorewall6.conf");
open(SHOREWALL_CONF, "<$config{'config_dir'}/shorewall6.conf");
while (<SHOREWALL_CONF>) {
chomp;
s/\r//;
@@ -85,7 +85,7 @@ sub read_table_file
{
local @rv;
local $func = $_[1];
open(FILE, "$config{'config_dir'}/$_[0]");
open(FILE, "<$config{'config_dir'}/$_[0]");
while(<FILE>) {
s/\r|\n//g;
local $l = &$func($_);
@@ -101,7 +101,7 @@ sub read_table_struct
if (!defined($read_table_cache{$_[0]})) {
local @rv;
local $func = $_[1];
open(FILE, "$config{'config_dir'}/$_[0]");
open(FILE, "<$config{'config_dir'}/$_[0]");
local $lnum = 0;
while(<FILE>) {
s/\r|\n//g;
@@ -1557,7 +1557,7 @@ sub list_standard_actions
{
local @rv;
foreach my $a (split(/\t+/, $config{'actions'})) {
open(ACTIONS, $a);
open(ACTIONS, "<".$a);
while(<ACTIONS>) {
s/\r|\n//g;
s/#.*$//;
@@ -1600,7 +1600,7 @@ sub get_shorewall6_version
{
local ($nocache) = @_;
local $version;
if (!$nocache && open(VERSION, "$module_config_directory/version")) {
if (!$nocache && open(VERSION, "<$module_config_directory/version")) {
chop($version = <VERSION>);
close(VERSION);
}
@@ -1626,7 +1626,7 @@ sub list_protocols
{
local @stdprotos = ( 'tcp', 'udp', 'ipv6-icmp' );
local @otherprotos;
open(PROTOS, "/etc/protocols");
open(PROTOS, "</etc/protocols");
while(<PROTOS>) {
s/\r|\n//g;
s/#.*$//;