From: Arthur Kepner <akepner-sJ/iWh9BUns@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org
Subject: [PATCH] opensm: accept looonnng partition.conf lines
Date: Mon, 24 Jan 2011 11:36:15 -0800 [thread overview]
Message-ID: <20110124193615.GP10691@sgi.com> (raw)
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/iWh9BUns@public.gmane.org>
---
opensm/opensm/osm_prtn_config.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/opensm/opensm/osm_prtn_config.c b/opensm/opensm/osm_prtn_config.c
index 0d02597..34676ef 100644
--- a/opensm/opensm/osm_prtn_config.c
+++ b/opensm/opensm/osm_prtn_config.c
@@ -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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2011-01-24 19:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110124193615.GP10691@sgi.com \
--to=akepner-sj/iwh9buns@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox