diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index 0b5116af6..16005639c 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -811,10 +811,6 @@ sub compiler { # Accounting. # setup_accounting if $config{ACCOUNTING}; - # - # Bail out now if errors - # - exit_if_errors; if ( $scriptfilename ) { # diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 0160c3c9a..79e0621e9 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -35,18 +35,17 @@ use warnings; use File::Basename; use File::Temp qw/ tempfile tempdir /; use Cwd qw(abs_path getcwd); -use autouse 'Carp' => qw(longmess confess cluck); +use autouse 'Carp' => qw(longmess confess); use Scalar::Util 'reftype'; use FindBin; our @ISA = qw(Exporter); # -# Imported variables should be treated as read-only by +# Imported variables should be treated as read-only by importers +# our @EXPORT = qw( warning_message fatal_error - nonfatal_error - exit_if_errors assert progress_message @@ -558,8 +557,6 @@ use constant { PLAIN_READ => 0, # No read_a_line options NORMAL_READ => -1 # All options }; -my $errors; - sub process_shorewallrc($); # # Rather than initializing globals in an INIT block or during declaration, @@ -598,7 +595,6 @@ sub initialize( $;$ ) { $ifstack = 0; @ifstack = (); $embedded = 0; - $errors = 0; # # Misc Globals # @@ -1111,9 +1107,9 @@ sub fatal_error { printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0]; if ( $confess ) { - print $log longmess( " FATAL ERROR: @_$currentlineinfo\n" ); + print $log longmess( " ERROR: @_$currentlineinfo\n" ); } else { - print $log " FATAL ERROR: @_$currentlineinfo\n"; + print $log " ERROR: @_$currentlineinfo\n"; } close $log; @@ -1126,8 +1122,8 @@ sub fatal_error { confess "@_$currentlineinfo" if $confess; die "@_$currentlineinfo\n"; } else { - confess " FATAL ERROR: @_$currentlineinfo" if $confess; - die " FATAL ERROR: @_$currentlineinfo\n"; + confess " ERROR: @_$currentlineinfo" if $confess; + die " ERROR: @_$currentlineinfo\n"; } } @@ -1139,9 +1135,9 @@ sub fatal_error1 { printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0]; if ( $debug ) { - print $log longmess( " FATAL ERROR: @_\n" ); + print $log longmess( " ERROR: @_\n" ); } else { - print $log " FATAL ERROR: @_\n"; + print $log " ERROR: @_\n"; } close $log; @@ -1149,65 +1145,8 @@ sub fatal_error1 { } cleanup; - confess " FATAL ERROR: @_" if $debug; - die " FATAL ERROR: @_\n"; -} - -# -# Issue non-fatal error message and die -# -sub nonfatal_error { - - fatal_error @_ unless $command eq 'check'; - - my $currentlineinfo = currentlineinfo; - - $| = 1; #Reset output buffering (flush any partially filled buffers). - - if ( $log ) { - our @localtime = localtime; - printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0]; - - if ( $confess ) { - print $log longmess( " ERROR: @_$currentlineinfo\n" ); - } else { - print $log " ERROR: @_$currentlineinfo\n"; - } - } - - if ( $confess ) { - cluck " ERROR: @_$currentlineinfo"; - } else { - print STDERR " ERROR: @_$currentlineinfo\n"; - } - - $errors++; - - $| = 0; - - 0; -} - -# -# Check for errors -# -sub exit_if_errors() { - if ( $errors ) { - $| = 1; #Reset output buffering (flush any partially filled buffers). - - if ( $log ) { - our @localtime = localtime; - printf $log '%s %2d %02d:%02d:%02d ', $abbr[$localtime[4]], @localtime[3,2,1,0]; - print $log "Check aborted -- $errors errors detected\n"; - - close $log; - $log = undef; - } - - cleanup; - - die "Check aborted -- $errors errors detected\n"; - } + confess " ERROR: @_" if $debug; + die " ERROR: @_\n"; } # @@ -3778,10 +3717,7 @@ sub determine_capabilities() { sub require_capability( $$$ ) { my ( $capability, $description, $singular ) = @_; - unless ( have_capability $capability ) { - nonfatal_error "$description require${singular} $capdesc{$capability} in your kernel and iptables"; - $capabilities{$capability} = 1; - } + fatal_error "$description require${singular} $capdesc{$capability} in your kernel and iptables" unless have_capability $capability; } #