[ofa-general] [PATCH] osm: handle first syntax error in policy file

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Thu Nov 15 04:03:17 PST 2007


When parsing QoS policy file for the first time, print
first syntax error to stdout and to the osm log.

Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 opensm/opensm/osm_qos_parser.y |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/opensm/opensm/osm_qos_parser.y b/opensm/opensm/osm_qos_parser.y
index 4738831..71f41fe 100644
--- a/opensm/opensm/osm_qos_parser.y
+++ b/opensm/opensm/osm_qos_parser.y
@@ -1873,12 +1873,21 @@ int __qos_parser_wrap()

 void __qos_parser_error (char *s)
 {
+    static boolean_t first_time = TRUE;
+    char * last_text_read = __parser_strip_white(__qos_parser_text);
     OSM_LOG_ENTER(p_qos_parser_osm_log, __qos_parser_error);
     osm_log(p_qos_parser_osm_log, OSM_LOG_ERROR,
             "__qos_parser_error: ERR AC05: "
             "Syntax error (line %d:%d): %s. "
             "Last text read: \"%s\"\n",
-            line_num, column_num, s, __parser_strip_white(__qos_parser_text));
+            line_num, column_num, s, last_text_read);
+    if (first_time)
+    {
+        first_time = FALSE;
+        printf("Error parsing QoS Policy File (line %d:%d): \"%s\". "
+               "Last text read: \"%s\".\n",
+               line_num, column_num, s, last_text_read);
+    }
     OSM_LOG_EXIT(p_qos_parser_osm_log);
 }

-- 
1.5.1.4





More information about the general mailing list