From 83e9a4ea8214c250207c0d107aeedb254f9d4181 Mon Sep 17 00:00:00 2001
From: eeb <eeb>
Date: Fri, 3 Oct 2003 11:40:39 +0000
Subject: [PATCH] *   Made lclt::disconnect ignore inappropriate NALs silently

---
 lnet/utils/portals.c           | 14 +++++++++-----
 lustre/portals/utils/portals.c | 14 +++++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c
index 5fe1777d64..2d1a0b5ec7 100644
--- a/lnet/utils/portals.c
+++ b/lnet/utils/portals.c
@@ -297,9 +297,13 @@ int g_nal_is_compatible (char *cmd, ...)
         
         if (g_nal == nal)
                 return (1);
-        
-        fprintf (stderr, "Command %s not compatible with nal %s\n",
-                 cmd, nal2name (g_nal));
+
+        if (cmd != NULL) {
+                /* Don't complain verbosely if we've not been passed a command
+                 * name to complain about! */
+                fprintf (stderr, "Command %s not compatible with nal %s\n",
+                         cmd, nal2name (g_nal));
+        }
         return (0);
 }
 
@@ -841,8 +845,8 @@ int jt_ptl_disconnect(int argc, char **argv)
                 return 0;
         }
 
-        if (!g_nal_is_compatible (argv[0], SOCKNAL, TOENAL, 0))
-                return -1;
+        if (!g_nal_is_compatible (NULL, SOCKNAL, TOENAL, 0))
+                return 0;
 
         if (argc >= 2 &&
             ptl_parse_nid (&nid, argv[1]) != 0) {
diff --git a/lustre/portals/utils/portals.c b/lustre/portals/utils/portals.c
index 5fe1777d64..2d1a0b5ec7 100644
--- a/lustre/portals/utils/portals.c
+++ b/lustre/portals/utils/portals.c
@@ -297,9 +297,13 @@ int g_nal_is_compatible (char *cmd, ...)
         
         if (g_nal == nal)
                 return (1);
-        
-        fprintf (stderr, "Command %s not compatible with nal %s\n",
-                 cmd, nal2name (g_nal));
+
+        if (cmd != NULL) {
+                /* Don't complain verbosely if we've not been passed a command
+                 * name to complain about! */
+                fprintf (stderr, "Command %s not compatible with nal %s\n",
+                         cmd, nal2name (g_nal));
+        }
         return (0);
 }
 
@@ -841,8 +845,8 @@ int jt_ptl_disconnect(int argc, char **argv)
                 return 0;
         }
 
-        if (!g_nal_is_compatible (argv[0], SOCKNAL, TOENAL, 0))
-                return -1;
+        if (!g_nal_is_compatible (NULL, SOCKNAL, TOENAL, 0))
+                return 0;
 
         if (argc >= 2 &&
             ptl_parse_nid (&nid, argv[1]) != 0) {
-- 
GitLab