From 56741f6152fd6751c87536ed445a6ae546688346 Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 1 Apr 2007 17:05:27 +0000 Subject: [PATCH] Remove dependency on TMP_DIR git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5787 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/Shorewall/Config.pm | 21 ++++++++------------- New/compiler.pl | 3 --- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/New/Shorewall/Config.pm b/New/Shorewall/Config.pm index 408935cd3..bd18fc1c1 100644 --- a/New/Shorewall/Config.pm +++ b/New/Shorewall/Config.pm @@ -228,10 +228,8 @@ my @openstack; my $currentfile; my $currentfilename; my $currentlinenumber = 0; -my $tmp_dir; INIT { - $tmp_dir = $ENV{TMP_DIR}; @config_path = split /:/, $ENV{CONFIG_PATH}; for ( @config_path ) { @@ -623,6 +621,8 @@ sub get_configuration( $ ) { my $uid = `id -u`; + fatal_error "Command 'id -u' failed" unless $? == 0; + chomp $uid; if ( ! $export && $uid == 0 ) { @@ -639,9 +639,12 @@ sub get_configuration( $ ) { } else { fatal_error "The -e flag requires a capabilities file" unless open_file 'capabilities'; } - + # + # If we successfully called open_file above, then this loop will read the capabilities file. + # Otherwise, the first call to read_a_line() below will return false + # while ( read_a_line ) { - if ( $line =~ /^\s*([a-zA-Z]\w*)=(.*?)\s*$/ ) { + if ( $line =~ /^([a-zA-Z]\w*)=(.*)$/ ) { my ($var, $val) = ($1, $2); unless ( exists $capabilities{$var} ) { warning_message "Unknown capability \"$var\" ignored"; @@ -650,7 +653,7 @@ sub get_configuration( $ ) { $capabilities{$var} = $val =~ /^\"([^\"]*)\"$/ ? $1 : $val; } else { - fatal_error "Unrecognized entry"; + fatal_error "Unrecognized capabilities entry"; } } @@ -889,12 +892,4 @@ sub generate_aux_config() { } -END { - if ( $tmp_dir ) { - my $exitstatus = $?; #Changed by system() - system "rm -rf $tmp_dir"; - $? = $exitstatus; - } -} - 1; diff --git a/New/compiler.pl b/New/compiler.pl index 4c0eefcd8..39d8c4491 100755 --- a/New/compiler.pl +++ b/New/compiler.pl @@ -32,9 +32,6 @@ # SHOREWALL_DIR A directory name was passed to /sbin/shorewall # VERBOSE Standard Shorewall verbosity control. # VERSION Shorewall Version -# TMP_DIR Temporary Directory containing stripped copies -# of all configuration files. Shell variable substitution -# has been performed on these files. # TIMESTAMP=Yes -t option specified to /sbin/shorewall # FW Firewall zone (for shell-variable expansion). #