opensm: accept looonnng partition.conf lines
PATCH 1/1 opensm: accept looonnng partition.conf lines
Sometimes we use partition.conf files with so many entries that the 1K buffer currently used by osm_prtn_config_parse_file() is too small. Use getline() to avoid that.
Signed-off-by <akepner-sJ/[email protected]>
--- opensm/opensm/osm_prtn_config.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
---
opensm/opensm/osm_prtn_config.c +6 -2
@@ -400,7 +400,9 @@ skip_header:int osm_prtn_config_parse_file (osm_log_t * p_log,osm_subn_t * p_subn,const char *file_name) { -char line[1024 ]; +char *line =NULL ; +ssize_t llen; +size_t n;struct part_conf *conf =NULL ;FILE *file;int lineno;
@@ -415,7 +417,7 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn, lineno =0 ; -while (fgets (line,sizeof (line) -1 , file) !=NULL ) { +while ((llen =getline (&line, &n, file)) !=-1 ) {char *q, *p = line; lineno++;
@@ -463,6 +465,8 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn, }while (q); } +free (line); +fclose (file);return 0 ;
--
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