[svn-commits] tzafrir: branch tools/tzafrir/sysfs r8568 - /tools/team/tzafrir/sysfs/xpp/per...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 26 11:17:32 CDT 2010


Author: tzafrir
Date: Mon Apr 26 11:17:28 2010
New Revision: 8568

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8568
Log:
Don't quietly exit if no pools file

An 'exit 0' at a library module just because of a missing optional config
file is not such a grand idea.

Modified:
    tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Pool.pm

Modified: tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Pool.pm
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Pool.pm?view=diff&rev=8568&r1=8567&r2=8568
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Pool.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Pool.pm Mon Apr 26 11:17:28 2010
@@ -110,25 +110,29 @@
 	return values %pools;
 }
 
-open(F, $cfgfile) || exit 0;
-while(<F>) {
-	chomp;
-	s/#.*//;
-	next unless /\S/;
-	my ($poolname, @dirs) = split;
-	die "$cfgfile:$.: Bad pool name '$poolname'\n"
-		if $poolname =~ m/[\/\.]/;
-	die "$cfgfile:$.: Pool '$poolname' without components\n"
-		unless @dirs;
-	die "$cfgfile:$.: Doubly defined pool '$poolname'\n"
-		if exists $pool_dirs{$poolname};
-	$pool_dirs{$poolname} = \@dirs;
-}
-close F;
+sub pool_init() {
+	open(F, $cfgfile) || return;
+	while(<F>) {
+		chomp;
+		s/#.*//;
+		next unless /\S/;
+		my ($poolname, @dirs) = split;
+		die "$cfgfile:$.: Bad pool name '$poolname'\n"
+			if $poolname =~ m/[\/\.]/;
+		die "$cfgfile:$.: Pool '$poolname' without components\n"
+			unless @dirs;
+		die "$cfgfile:$.: Doubly defined pool '$poolname'\n"
+			if exists $pool_dirs{$poolname};
+		$pool_dirs{$poolname} = \@dirs;
+	}
+	close F;
 
-foreach my $poolname (keys %pool_dirs) {
-	my $p = Dahdi::Pool->new($poolname);
-	$pools{$poolname} = $p;
+	foreach my $poolname (keys %pool_dirs) {
+		my $p = Dahdi::Pool->new($poolname);
+		$pools{$poolname} = $p;
+	}
 }
 
+pool_init();
+
 1;




More information about the svn-commits mailing list