summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbustico2008-02-13 13:45:36 +0000
committerbustico2008-02-13 13:45:36 +0000
commitb346324cf273f8e41872f055e1382133627f7059 (patch)
tree6725caa98740b9606000b4390e799087c1fad886
parenta069d727264511de2fe6cf4a97d1b0358da0a605 (diff)
downloadivy-perl-b346324cf273f8e41872f055e1382133627f7059.zip
ivy-perl-b346324cf273f8e41872f055e1382133627f7059.tar.gz
ivy-perl-b346324cf273f8e41872f055e1382133627f7059.tar.bz2
ivy-perl-b346324cf273f8e41872f055e1382133627f7059.tar.xz
verify validity of data structure before using it
-rw-r--r--Ivy.pm11
-rw-r--r--debian/changelog7
-rwxr-xr-xexample/ivyprobe.pl9
3 files changed, 21 insertions, 6 deletions
diff --git a/Ivy.pm b/Ivy.pm
index 8a1004f..7d96e63 100644
--- a/Ivy.pm
+++ b/Ivy.pm
@@ -1,7 +1,7 @@
#
# Ivy, Perl interface
#
-# Copyright 1997-2006
+# Copyright 1997-2008
# Centre d'Études de la Navigation Aérienne
#
# Authors: Alexandre Bustico <alexandre.bustico@cena.fr>
@@ -1519,7 +1519,8 @@ sub _getMessages ($$)
# on recupere le couple call back, regexp correspondant
# a l'identifiant et on appelle la fonction avec les parametres
# traites par la regexp
- if (my @cb = @{$self->[recCbList][$id]->[1]}) {
+ if (ref ($self->[recCbList][$id]) eq 'ARRAY') {
+ my @cb = @{$self->[recCbList][$id]->[1]};
my $cb = shift @cb;
# cleaning $sendername with previous \004 used for connection status
@@ -1778,10 +1779,8 @@ sub _removeFileDescriptor ($$$)
# uniquement si on est dans le thread principal
# sinon le select merde salement sur ce coup
my $peerPort = $fd->peerport() ;
- if ($peerPort == 0) {
-# syswrite ($trace, "_removeFileDescriptor : peerport is NULL, don't do anything\n");
- return;
- }
+ $peerPort = 0 unless defined $peerPort;
+
# syswrite ($trace, sprintf ("_removeFileDescriptor : suppression dans le fdset de %s[%s]:%d\n",
# (gethostbyaddr ($fd->peeraddr(),AF_INET))[0],
# join (':', unpack ('C4', $fd->peeraddr())),
diff --git a/debian/changelog b/debian/changelog
index 7b015ed..8752546 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ivy-perl (4.25-4) unstable; urgency=low
+
+ * New upstream version: * verify validity of data structure before using
+ it
+
+ -- Alexandre Bustico <bustico@cena.fr> Wed, 13 Fev 2008 14:43:00 +0200
+
ivy-perl (4.25-3) unstable; urgency=low
* New upstream version: * restrict lexical scope of use bytes pragma
diff --git a/example/ivyprobe.pl b/example/ivyprobe.pl
index 41efe78..ba095df 100755
--- a/example/ivyprobe.pl
+++ b/example/ivyprobe.pl
@@ -34,6 +34,8 @@ my $timestamp = 0;
my $noReadLineMode ;
my $regexpFile;
my $classes;
+my $messCount=0;
+
my @classes = ();
# for each application gives the number of running instances
@@ -125,6 +127,12 @@ $Ivyobj->fileEvent(*STDIN, \&cb);
$Ivyobj->mainLoop();
+sub printtime_mess {
+ return if (!$timestamp);
+ my ($sec,$min,$hour) = localtime();
+ printf "[%02d:%02d:%02d>>%d] ", $hour, $min, $sec, $messCount++;
+}
+
sub printtime {
return if (!$timestamp);
my ($sec,$min,$hour) = localtime();
@@ -277,6 +285,7 @@ sub callback {
my $paramString = "";
if (scalar @param) { $paramString = join ("' '", @param); }
+ printtime_mess();
print "$appname sent '", $paramString, "'\n";
}