Return-Path: Received: from e37.co.us.ibm.com ([32.97.110.158]:45117 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755411Ab2GJXsu (ORCPT ); Tue, 10 Jul 2012 19:48:50 -0400 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Jul 2012 17:48:50 -0600 From: cody@linux.vnet.ibm.com Subject: [PATCH] kconfig: allow long lines in config file Date: Tue, 10 Jul 2012 16:47:58 -0700 Message-Id: <1341964078-22594-1-git-send-email-cody@linux.vnet.ibm.com> Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Michal Marek Cc: Cody Schafer , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org From: Cody Schafer For some config options (CONFIG_EXTRA_FIRMWARE, for example), the length of a config file line can exceed the 1024 byte buffer. Switch from fgets to getline to fix. Signed-off-by: Cody Schafer --- scripts/kconfig/confdata.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 52577f0..175037f 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -185,7 +185,8 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) int conf_read_simple(const char *name, int def) { FILE *in = NULL; - char line[1024]; + char *line = NULL; + size_t line_asize = 0; char *p, *p2; struct symbol *sym; int i, def_flags; @@ -247,7 +248,7 @@ load: } } - while (fgets(line, sizeof(line), in)) { + while (getline(&line, &line_asize, in) != -1) { conf_lineno++; sym = NULL; if (line[0] == '#') { @@ -335,6 +336,7 @@ setsym: cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); } } + free(line); fclose(in); if (modules_sym) -- 1.7.9.5