Skip to contentSkip to conversation

pensm/osm_qos_parser: QOS parser doesn't work after syntax error

PATCH In review Yevgeny Kliteynik 2 participants 2 messages Mar 7, 2011 – Mar 22, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pensm/osm_qos_parser: QOS parser doesn't work after syntax error

If there was a syntax error in the QoS policy file, any subsequent parsing fails, even if the error is fixed. The reason is that the parser doesn't clean its buffer - need to clean it explicitly when exiting parsing.

---
 opensm/opensm/osm_qos_parser_l.l |    4 ++++
 opensm/opensm/osm_qos_parser_y.y |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
opensm/opensm/osm_qos_parser_l.l +4 -0
index 4633e0e..559974b 100644
@@ -355,6 +355,10 @@ QUOTED_TEXT             \"[^\"]*\"
 
 .                   { SAVE_POS; yylval = strdup(yytext); return TK_TEXT;}
 
+<<EOF>>             {
+                        YY_NEW_FILE;
+                        yyterminate();
+                    }
 %%
 
 
opensm/opensm/osm_qos_parser_y.y +4 -0
index 7118b79..51f72e3 100644
@@ -149,6 +149,7 @@ extern char * yytext;
 extern int yylex (void);
 extern FILE * yyin;
 extern int errno;
+extern void yyrestart(FILE *input_file);
 int yyparse();
 
 #define RESET_BUFFER  __parser_tmp_struct_reset()
@@ -2354,7 +2355,10 @@ int osm_qos_parse_policy_file(IN osm_subn_t * p_subn)
 
   Exit:
     if (yyin)
+    {
+        yyrestart(yyin);
         fclose(yyin);
+    }
     OSM_LOG_EXIT(p_qos_parser_osm_log);
     return res;
 }
Signature · 6 lines
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4D74F8EC.3090504-VPRAkNaXOzVS1MOuV/[email protected]

#2 lore raw
Quoted 8 lines · Yevgeny Kliteynik

If there was a syntax error in the QoS policy file, any subsequent parsing fails, even if the error is fixed. The reason is that the parser doesn't clean its buffer - need to clean it explicitly when exiting parsing.

---

Applied. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html