[Pkg-voip-commits] [dahdi-tools] 34/285: Span.pm: Process the /proc/dahdi/<x> files atomically.

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit caa8c947b72b3ef8b08de54bd404e66612baf1c9
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Tue Jul 12 23:01:02 2011 +0000

    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>
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10040 17933a7a-c749-41c5-a318-cba88f637d49
---
 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(<F>) {
+	my @channel_lines = <F>;
+	foreach (@channel_lines) {
 		chomp;
 		s/^\s*//;
 		s/\s*$//;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list