public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: allow long lines in config file
@ 2012-07-10 23:47 cody
  2012-07-13 13:07 ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: cody @ 2012-07-10 23:47 UTC (permalink / raw)
  To: Michal Marek; +Cc: Cody Schafer, linux-kbuild, linux-kernel

From: Cody Schafer <cody@linux.vnet.ibm.com>

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 <cody@linux.vnet.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-13 20:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10 23:47 [PATCH] kconfig: allow long lines in config file cody
2012-07-13 13:07 ` Michal Marek
2012-07-13 18:27   ` [PATCH v2] " cody
2012-07-13 20:54     ` Michal Marek
2012-07-13 18:30   ` [PATCH] " cody
2012-07-13 20:39     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox