[ofa-general] [PATCH] opensm/osm_console.c: fix guid parsing

Sasha Khapyorsky sashak at voltaire.com
Sun Jun 15 04:50:34 PDT 2008


Fix switch guid parsing used in lidbalance and switchbalance commands,
use strtoull() instead of strtoul() which truncates 64-bit GUID value
on 32-bit machines.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_console.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index 6db7aa6..59b2ed9 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -828,7 +828,7 @@ static void switchbalance_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 		}
 
 		if (p_cmd) {
-			guid = strtoul(p_cmd, &p_end, 0);
+			guid = strtoull(p_cmd, &p_end, 0);
 			if (!guid || *p_end != '\0') {
 				fprintf(out, "Invalid guid specified\n");
 				help_switchbalance(out, 1);
@@ -1031,7 +1031,7 @@ static void lidbalance_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 	if (p_cmd) {
 		char *p_end;
 
-		switchguid = strtoul(p_cmd, &p_end, 0);
+		switchguid = strtoull(p_cmd, &p_end, 0);
 		if (!switchguid || *p_end != '\0') {
 			fprintf(out, "Invalid switchguid specified\n");
 			help_lidbalance(out, 1);
-- 
1.5.5.1.178.g1f811




More information about the general mailing list