Fix object file naming problem

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5544 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-15 03:56:40 +00:00
parent d755c39fe3
commit 1c2fe3bc88
3 changed files with 10 additions and 8 deletions

View File

@ -14,6 +14,7 @@ our @EXPORT = qw(ALLIPv4
finalize_object finalize_object
emit emit
emit_unindented emit_unindented
emit_as_is
save_progress_message save_progress_message
save_progress_message_short save_progress_message_short
progress_message progress_message
@ -88,12 +89,13 @@ sub create_temp_object( $ ) {
fatal_error "$@" if $@; fatal_error "$@" if $@;
$file = "$dir/$file.$suffix"; $file = "$file.$suffix" if $suffix;
$file = $dir . $file;
} }
sub finalize_object() { sub finalize_object() {
rename $tempfile, $file; rename $tempfile, $file or fatal_error "Cannot Rename $tempfile to $file: $!";
chmod 0700, $file; chmod 0700, $file;
} }
@ -126,6 +128,10 @@ sub emit_unindented( $ ) {
print $object "$_[0]\n" if $object; print $object "$_[0]\n" if $object;
} }
sub emit_as_is( $ ) {
print $object "$_[0]" if $object;
}
# #
# Write a progress_message2 command to the output file. # Write a progress_message2 command to the output file.
# #

View File

@ -311,11 +311,7 @@ sub complete_standard_chain ( $$$ ) {
$policychainref = $ruleschainref->{policychain} if $ruleschainref; $policychainref = $ruleschainref->{policychain} if $ruleschainref;
if ( $policychainref ) { ( $policy, $loglevel, $default ) = @{$policychainref}{'policy', 'loglevel', 'default' } if $policychainref;
$policy = $policychainref->{policy};
$loglevel = $policychainref->{loglevel};
$default = $policychainref->{default};
}
policy_rules $stdchainref , $policy , $loglevel, $default; policy_rules $stdchainref , $policy , $loglevel, $default;
} }

View File

@ -601,7 +601,7 @@ sub generate_script_2 () {
open MF, $mf or fatal_error "Unable to open $mf: $!"; open MF, $mf or fatal_error "Unable to open $mf: $!";
while ( $line = <MF> ) { emit_unindented $line if $line =~ /^\s*loadmodule\b/; } while ( $line = <MF> ) { emit_as_is $line if $line =~ /^\s*loadmodule\b/; }
close MF; close MF;