[ofa-general] [PATCH] infiniband-diags/scripts/ibprintswitch.pl: fix printing of ports

Ira Weiny weiny2 at llnl.gov
Fri Feb 29 11:34:58 PST 2008


>From 9bbe965428a44751c0068f536a03b43c723bb57c Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Fri, 29 Feb 2008 11:32:06 -0800
Subject: [PATCH] infiniband-diags/scripts/ibprintswitch.pl: fix printing of ports

   When there was only one switch in the system this would fail to print the
   switch ports as designed.  This fixes this and makes the code consistent
   with printca and printrt.

Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/scripts/ibprintswitch.pl |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/infiniband-diags/scripts/ibprintswitch.pl b/infiniband-diags/scripts/ibprintswitch.pl
index 2dc0040..6712201 100755
--- a/infiniband-diags/scripts/ibprintswitch.pl
+++ b/infiniband-diags/scripts/ibprintswitch.pl
@@ -97,9 +97,7 @@ sub main
 			my $desc = $2;
 			if ($in_switch eq "yes") {
 				$in_switch = "no";
-				foreach my $port (sort { $a <=> $b } (keys %ports)) {
-					print $ports{$port};
-				}
+				goto DONE;
 			}
 			if ("0x$guid" eq $target_switch || $desc =~ /.*$target_switch.*/) {
 				print $line;
@@ -114,7 +112,10 @@ sub main
 		}
 
 	}
-
+	DONE:
+	foreach my $port (sort { $a <=> $b } (keys %ports)) {
+		print $ports{$port};
+	}
 	if (!$found_switch) {
 		print "Switch \"$target_switch\" not found\n";
 		print "   Try running with the \"-R\" option.\n";
-- 
1.5.1



More information about the general mailing list