[openib-general] [PATCH] OpenSM - Clearer error message in osm_db_files.c
Yael Kalka
yael at mellanox.co.il
Wed Mar 8 01:48:41 PST 2006
Hi Hal,
The following patch adds the full path name of the guid2lid file in
case of an error in parsing the file (which causes opensm to exit).
Also - there is a check that the guid given is in legal size.
Thanks,
Yael
Signed-off-by: Yael Kalka <yael at mellanox.co.il>
Index: opensm/osm_db_files.c
===================================================================
--- opensm/osm_db_files.c (revision 5671)
+++ opensm/osm_db_files.c (working copy)
@@ -64,6 +64,18 @@
#define OSM_DB_MAX_LINE_LEN 1024
/**********/
+/****d* Database/OSM_DB_MAX_GUID_LEN
+ * NAME
+ * OSM_DB_MAX_GUID_LEN
+ *
+ * DESCRIPTION
+ * The Maximal word length allowed for the file (guid or lid)
+ *
+ * SYNOPSIS
+ */
+#define OSM_DB_MAX_GUID_LEN 32
+/**********/
+
/****s* OpenSM: Database/osm_db_domain_imp
* NAME
* osm_db_domain_imp
@@ -335,8 +347,17 @@ osm_db_restore(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_restore: ERR 6104: "
- " Fail to get key from line:%u : %s\n",
- line_num, sLine);
+ " Fail to get key from line:%u : %s (file:%s)\n",
+ line_num, sLine, p_domain_imp->file_name);
+ status = 1;
+ goto EndParsing;
+ }
+ if (strlen(p_first_word) > OSM_DB_MAX_GUID_LEN)
+ {
+ osm_log( p_log, OSM_LOG_ERROR,
+ "osm_db_restore: ERR 610A: "
+ " Illegal key from line:%u : %s (file:%s)\n",
+ line_num, sLine, p_domain_imp->file_name);
status = 1;
goto EndParsing;
}
@@ -361,8 +382,8 @@ osm_db_restore(
{
osm_log( p_log, OSM_LOG_ERROR,
"osm_db_restore: ERR 6105: "
- " How did we get here? line:%u : %s\n",
- line_num, sLine);
+ " How did we get here? line:%u : %s (file:%s)\n",
+ line_num, sLine, p_domain_imp->file_name);
status = 1;
goto EndParsing;
}
More information about the general
mailing list