[dahdi-commits] sruffell: tools/trunk r10040 - /tools/trunk/xpp/perl_modules/Dahdi/Span.pm

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Tue Jul 12 18:01:06 CDT 2011


Author: sruffell
Date: Tue Jul 12 18:01:02 2011
New Revision: 10040

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10040
Log:
Span.pm: Process the /proc/dahdi/<x> files atomically.

It is possible that the contents of the proc files can change while the
perl modules are in the processing of processing them.

Specifically, if lsdahdi is called on boot before the channels are
configured, the channel will be "probed" to determine if it's an FXO or
FXS channel and that can result in the output of proc changing. When the
size of proc changes, the script can get confused about where the
beginning of the next line is.

This patch reads in the proc file completely into memory first, and then
starts processing each of the lines.

This resolves the "Unrecognized garbage 'INACTIVE)' in -" that is
displayed on boot with the recent trunk of DAHDI.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    tools/trunk/xpp/perl_modules/Dahdi/Span.pm

Modified: tools/trunk/xpp/perl_modules/Dahdi/Span.pm
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/xpp/perl_modules/Dahdi/Span.pm?view=diff&rev=10040&r1=10039&r2=10040
==============================================================================
--- tools/trunk/xpp/perl_modules/Dahdi/Span.pm (original)
+++ tools/trunk/xpp/perl_modules/Dahdi/Span.pm Tue Jul 12 18:01:02 2011
@@ -236,7 +236,8 @@
 	$self->{CHANS} = [];
 	my @channels;
 	my $index = 0;
-	while(<F>) {
+	my @channel_lines = <F>;
+	foreach (@channel_lines) {
 		chomp;
 		s/^\s*//;
 		s/\s*$//;




More information about the dahdi-commits mailing list