[ofa-general] [PATCH] opensm: make formats of node map names and up/down guid ids files identical
Sasha Khapyorsky
sashak at voltaire.com
Sun Mar 30 06:32:01 PDT 2008
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
opensm/complib/cl_nodenamemap.c | 8 +++-----
opensm/opensm/osm_ucast_updn.c | 3 ++-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/opensm/complib/cl_nodenamemap.c b/opensm/complib/cl_nodenamemap.c
index 696d455..d09863a 100644
--- a/opensm/complib/cl_nodenamemap.c
+++ b/opensm/complib/cl_nodenamemap.c
@@ -170,7 +170,7 @@ int parse_node_map(const char *file_name,
if (!(f = fopen(file_name, "r")))
return -1;
- while (fgets(line, sizeof(line),f)) {
+ while (fgets(line, sizeof(line), f)) {
uint64_t guid;
char *p, *e;
@@ -181,18 +181,16 @@ int parse_node_map(const char *file_name,
continue;
guid = strtoull(p, &e, 0);
- if (e == p || !isspace(*e)) {
+ if (e == p || (!isspace(*e) && *e != '#' && *e != '\0')) {
fclose(f);
return -1;
}
p = e;
- if (*e)
- e++;
while (isspace(*p))
p++;
- e = strpbrk(p, "# \t\n");
+ e = strpbrk(p, "\n");
if (e)
*e = '\0';
diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c
index 5e778c2..0c4df5d 100644
--- a/opensm/opensm/osm_ucast_updn.c
+++ b/opensm/opensm/osm_ucast_updn.c
@@ -49,6 +49,7 @@
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
+#include <ctype.h>
#include <complib/cl_debug.h>
#include <complib/cl_qmap.h>
#include <opensm/osm_switch.h>
@@ -446,7 +447,7 @@ static int update_id(void *cxt, uint64_t guid, char *p)
}
id = strtoull(p, &e, 0);
- if (*e) {
+ if (*e && !isspace(*e)) {
OSM_LOG(&osm->log, OSM_LOG_ERROR,
"ERR: cannot parse node id \'%s\'", p);
return -1;
--
1.5.4.1.122.gaa8d
More information about the general
mailing list