From f9253588728b730ff9d95436cb23e74174ed3159 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 23 Dec 2014 12:27:37 -0800 Subject: [PATCH] Minor Compiler Reorganization Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Compiler.pm | 23 ++++++++++------------- Shorewall/Perl/Shorewall/Config.pm | 1 + 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index d36f7430a..29ceeb782 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -649,10 +649,7 @@ sub compiler { set_config_path( $config_path ) if $config_path; - if ( $directory ne '' ) { - fatal_error "$directory is not an existing directory" unless -d $directory; - set_shorewall_dir( $directory ); - } + set_shorewall_dir( $directory ) if $directory ne ''; $verbosity = 1 if $debug && $verbosity < 1; @@ -665,15 +662,6 @@ sub compiler { # get_configuration( $export , $update , $annotate , $directives , $inline ); # - # Create a temp file to hold the script - # - if ( $scriptfilename ) { - set_command( 'compile', 'Compiling', 'Compiled' ); - create_temp_script( $scriptfilename , $export ); - } else { - set_command( 'check', 'Checking', 'Checked' ); - } - # # Chain table initialization depends on shorewall.conf and capabilities. So it must be deferred until # now when shorewall.conf has been processed and the capabilities have been determined. # @@ -683,6 +671,15 @@ sub compiler { # run_user_exit1 'compile'; # + # Create a temp file to hold the script + # + if ( $scriptfilename ) { + set_command( 'compile', 'Compiling', 'Compiled' ); + create_temp_script( $scriptfilename , $export ); + } else { + set_command( 'check', 'Checking', 'Checked' ); + } + # # Z O N E D E F I N I T I O N # (Produces no output to the compiled script) # diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index eb08c39ae..53c7b9d0c 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -4752,6 +4752,7 @@ sub ensure_config_path() { # sub set_shorewall_dir( $ ) { $shorewall_dir = shift; + fatal_error "$shorewall_dir is not an existing directory" unless -d $shorewall_dir; ensure_config_path; }