nodenames can have spaces in them
Also, no need for next_token being inlined

Signed-off-by: Hal Rosenstock <[email protected]>

---
diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index 00e2a94..9cad594 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -73,11 +73,16 @@ on: 0, delay_s: 2, loop_function:NULL};
 
 static const struct command console_cmds[];
 
-static inline char *next_token(char **p_last)
+static char *next_token(char **p_last)
 {
        return strtok_r(NULL, " \t\n\r", p_last);
 }
 
+static char *name_token(char **p_last)
+{
+       return strtok_r(NULL, "\t\n\r", p_last);
+}
+
 static void help_command(FILE * out, int detail)
 {
        int i;
@@ -1152,7 +1157,7 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * 
p_osm, FILE * out)
                                                          
PERFMGR_EVENT_DB_DUMP_HR);
                        }
                } else if (strcmp(p_cmd, "print_counters") == 0) {
-                       p_cmd = next_token(p_last);
+                       p_cmd = name_token(p_last);
                        if (p_cmd) {
                                osm_perfmgr_print_counters(&p_osm->perfmgr,
                                                           p_cmd, out);
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 3babe3a..8766f93 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -1304,9 +1304,9 @@ void
 osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp)
 {
        uint64_t guid = strtoull(nodename, NULL, 0);
-       if (guid == 0 && errno == EINVAL)
+       if (guid == 0 && errno) // name
                perfmgr_db_print_by_name(pm->db, nodename, fp);
-       else
+       else            // guid
                perfmgr_db_print_by_guid(pm->db, guid, fp);
 }
 
_______________________________________________
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