Correct CONFIG_PATH search when filename contains '/'; avoid confusing failure messages from buildports.pm

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6729 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-06-30 16:11:56 +00:00
parent 972561eb71
commit 265170ff66
2 changed files with 9 additions and 5 deletions

View File

@ -361,7 +361,7 @@ sub find_file($)
{
my $filename=$_[0];
return $filename if substr( $filename, 0, 1 ) eq '/';
return $filename if $filename =~ '/';
my $directory;

View File

@ -65,10 +65,14 @@ sub print_service( $$ ) {
$service_hash{$service} = $number;
}
}
#
# E x e c u t i o n B e g i n s H e r e
#
set_config_path( '/etc' );
set_config_path( '/etc/shorewall:/usr/share/shorewall' );
our $dir = $ARGV[0] || '/etc';
set_shorewall_dir($ARGV[0] || '/etc');
$dir =~ s|/+$|| unless $dir eq '/';
our $date = localtime;
@ -116,7 +120,7 @@ our $VERSION = '1.00';
our %protocols = (
EOF
open_file 'protocols' or fatal_error "Cannot open protocols: $!";
open_file "$dir/protocols" or fatal_error "Cannot open $dir/protocols: $!";
while ( read_a_line1 ) {
my ( $proto1, $number, @aliases ) = split_line( 2, 10, '/etc/protocols entry');
@ -133,7 +137,7 @@ print "\t\t );\n\n";
print "our %services = (\n";
open_file 'services' or fatal_error "Cannot open services: $!";
open_file "$dir/services" or fatal_error "Cannot open $dir/services: $!";
while ( read_a_line1 ) {
my ( $name1, $proto_number, @names ) = split_line( 2, 10, '/etc/services entry');