From 1c2fe3bc88d92ab5563447c28dabe9218b34bd0d Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 15 Mar 2007 03:56:40 +0000 Subject: [PATCH] Fix object file naming problem git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5544 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/Shorewall/Common.pm | 10 ++++++++-- New/Shorewall/Policy.pm | 6 +----- New/compiler.pl | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/New/Shorewall/Common.pm b/New/Shorewall/Common.pm index 76b66e8be..27825310a 100644 --- a/New/Shorewall/Common.pm +++ b/New/Shorewall/Common.pm @@ -14,6 +14,7 @@ our @EXPORT = qw(ALLIPv4 finalize_object emit emit_unindented + emit_as_is save_progress_message save_progress_message_short progress_message @@ -88,12 +89,13 @@ sub create_temp_object( $ ) { fatal_error "$@" if $@; - $file = "$dir/$file.$suffix"; + $file = "$file.$suffix" if $suffix; + $file = $dir . $file; } sub finalize_object() { - rename $tempfile, $file; + rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!"; chmod 0700, $file; } @@ -126,6 +128,10 @@ sub emit_unindented( $ ) { print $object "$_[0]\n" if $object; } +sub emit_as_is( $ ) { + print $object "$_[0]" if $object; +} + # # Write a progress_message2 command to the output file. # diff --git a/New/Shorewall/Policy.pm b/New/Shorewall/Policy.pm index bc5150c06..c45b00708 100644 --- a/New/Shorewall/Policy.pm +++ b/New/Shorewall/Policy.pm @@ -311,11 +311,7 @@ sub complete_standard_chain ( $$$ ) { $policychainref = $ruleschainref->{policychain} if $ruleschainref; - if ( $policychainref ) { - $policy = $policychainref->{policy}; - $loglevel = $policychainref->{loglevel}; - $default = $policychainref->{default}; - } + ( $policy, $loglevel, $default ) = @{$policychainref}{'policy', 'loglevel', 'default' } if $policychainref; policy_rules $stdchainref , $policy , $loglevel, $default; } diff --git a/New/compiler.pl b/New/compiler.pl index e238e855b..d71c653d6 100755 --- a/New/compiler.pl +++ b/New/compiler.pl @@ -601,7 +601,7 @@ sub generate_script_2 () { open MF, $mf or fatal_error "Unable to open $mf: $!"; - while ( $line = ) { emit_unindented $line if $line =~ /^\s*loadmodule\b/; } + while ( $line = ) { emit_as_is $line if $line =~ /^\s*loadmodule\b/; } close MF;