From 1cadf721ae5c596568b238858050cceec96f2647 Mon Sep 17 00:00:00 2001 From: teastep Date: Tue, 12 Jun 2007 02:03:26 +0000 Subject: [PATCH] Fix initialization problem git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6521 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-common/releasenotes.txt | 6 +++++- Shorewall-perl/compiler.pl | 14 ++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Shorewall-common/releasenotes.txt b/Shorewall-common/releasenotes.txt index bc70c63ab..04000e490 100644 --- a/Shorewall-common/releasenotes.txt +++ b/Shorewall-common/releasenotes.txt @@ -99,7 +99,11 @@ Other changes in Shorewall 4.0.0 Beta 5. configuration is compiled into the named file. Compilation errors cause the compiler to raise an exception via - die. + die. + + Important: Currently, the 'compiler' function may only + be called once in a process. I'll work on removing that + restriction but that isn't a high priority for me. Migration Considerations: diff --git a/Shorewall-perl/compiler.pl b/Shorewall-perl/compiler.pl index e0dc38ac3..c90b364d4 100755 --- a/Shorewall-perl/compiler.pl +++ b/Shorewall-perl/compiler.pl @@ -25,7 +25,6 @@ # use strict; use lib '/usr/share/shorewall-perl'; -use Shorewall::Compiler; use Getopt::Long; sub usage() { @@ -37,7 +36,7 @@ sub usage() { # Getopt::Long::Configure ('bundling'); -my ( $export , $shorewall_dir, $verbose, $timestamp ) = qw( 0 '' '' '' ); +my ( $export , $shorewall_dir, $verbose, $timestamp ) = ( 0, '', '', '' ); my $result = GetOptions('export' => \$export, 'e' => \$export, @@ -50,10 +49,13 @@ my $result = GetOptions('export' => \$export, usage unless $result && @ARGV < 2; -eval { - configure( $export, $shorewall_dir, $verbose, $timestamp ); - compiler $ARGV[0]; -}; + { + eval { + use Shorewall::Compiler; + configure( $export, $shorewall_dir, $verbose, $timestamp ); + compiler $ARGV[0]; + }; + } if ( $@ ) { print STDERR $@;