Improve the fix for SELinux "getattr" denials

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2017-09-28 15:16:00 -07:00
parent baa791a1e3
commit 3d2e9eb93e
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -1994,6 +1994,7 @@ sub find_file($)
for my $directory ( @config_path ) { for my $directory ( @config_path ) {
my $file = "$directory$filename"; my $file = "$directory$filename";
return $file if -f $file; return $file if -f $file;
$!{ENOENT} || fatal_error "Unable to access $file: " . $!;
} }
"$config_path[0]$filename"; "$config_path[0]$filename";
@ -2570,22 +2571,18 @@ sub open_file( $;$$$$ ) {
assert( ! defined $currentfile ); assert( ! defined $currentfile );
if ( -f $fname ) { if ( -f $fname && -s _ ) {
if ( -s _ ) {
$first_entry = 0; $first_entry = 0;
$file_format = supplied $cf ? $cf : 1; $file_format = supplied $cf ? $cf : 1;
$max_format = supplied $mf ? $mf : 1; $max_format = supplied $mf ? $mf : 1;
$comments_allowed = supplied $ca ? $ca : 0; $comments_allowed = supplied $ca ? $ca : 0;
$nocomment = $nc; $nocomment = $nc;
return do_open_file $fname; do_open_file $fname;
}
} else { } else {
$!{ENOENT} or fatal_error "Unable to open file $fname: " . $!;
}
$ifstack = @ifstack; $ifstack = @ifstack;
''; '';
} }
}
# #
# Push open-specific globals onto the include stack # Push open-specific globals onto the include stack