From b62d766c1338accbf7c2a58dc290837123cdb13d Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Tue, 12 Jul 2011 23:01:02 +0000 Subject: Span.pm: Process the /proc/dahdi/ 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 Signed-off-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@10040 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- xpp/perl_modules/Dahdi/Span.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xpp/perl_modules/Dahdi/Span.pm b/xpp/perl_modules/Dahdi/Span.pm index 367ca08..4e63af4 100644 --- a/xpp/perl_modules/Dahdi/Span.pm +++ b/xpp/perl_modules/Dahdi/Span.pm @@ -236,7 +236,8 @@ sub new($$) { $self->{CHANS} = []; my @channels; my $index = 0; - while() { + my @channel_lines = ; + foreach (@channel_lines) { chomp; s/^\s*//; s/\s*$//; -- cgit v1.2.3