>From 9bbe965428a44751c0068f536a03b43c723bb57c Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>
---
 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
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to