From patchwork Mon Jan 24 19:36:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Kepner X-Patchwork-Id: 501851 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0OJh2Zb026265 for ; Mon, 24 Jan 2011 19:48:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752814Ab1AXTgS (ORCPT ); Mon, 24 Jan 2011 14:36:18 -0500 Received: from relay3.sgi.com ([192.48.152.1]:52502 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752153Ab1AXTgQ (ORCPT ); Mon, 24 Jan 2011 14:36:16 -0500 Received: from localhost (sshcf.sgi.com [198.149.20.12]) by relay3.corp.sgi.com (Postfix) with ESMTP id A1935AC004; Mon, 24 Jan 2011 11:36:15 -0800 (PST) Date: Mon, 24 Jan 2011 11:36:15 -0800 From: Arthur Kepner To: linux-rdma@vger.kernel.org Cc: sashak@voltaire.com Subject: [PATCH] opensm: accept looonnng partition.conf lines Message-ID: <20110124193615.GP10691@sgi.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 24 Jan 2011 19:48:26 +0000 (UTC) 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;