Hi Jean, adding Michal (current kbuild maintainer) and linux-kbuild to CC. Thanks. From: Jean Sacren <sakiwit@xxxxxxxxx> Date: Fri, 9 Jul 2010 13:02:50 -0600 Subject: [PATCH 1/1] kconfig: Fix ignoring return value warning This fix takes care of fwrite() either when it succeeds with writing or when an error occurs. Also more aesthetic syntax is entered for infinite loops. Signed-off-by: Jean Sacren <sakiwit@xxxxxxxxx> --- scripts/kconfig/confdata.c | 22 +++++++++++++++++----- scripts/kconfig/lkc.h | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index c4dec80..c6871d9 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -502,10 +502,10 @@ int conf_write(const char *name) case S_STRING: str = sym_get_string_value(sym); fprintf(out, "CONFIG_%s=\"", sym->name); - while (1) { + for (;;) { l = strcspn(str, "\"\\"); if (l) { - fwrite(str, l, 1, out); + xfwrite(str, l, 1, out); str += l; } if (!*str) @@ -753,11 +753,11 @@ int conf_write_autoconf(void) str = sym_get_string_value(sym); fprintf(out, "CONFIG_%s=\"", sym->name); fprintf(out_h, "#define CONFIG_%s \"", sym->name); - while (1) { + for (;;) { l = strcspn(str, "\"\\"); if (l) { - fwrite(str, l, 1, out); - fwrite(str, l, 1, out_h); + xfwrite(str, l, 1, out); + xfwrite(str, l, 1, out_h); str += l; } if (!*str) @@ -926,3 +926,15 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) csym->flags &= ~(SYMBOL_VALID); } } +/* + * Helper function to facilitate fwrite() by Jean Sacren. + */ +void xfwrite(xstr, len, count, output) + const void *xstr; + size_t len; + size_t count; + FILE *output; +{ + if (fwrite(xstr, len, count, output) < count) + fprintf(stderr, "\nError in writing.\n"); +} diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index ce6549c..7d7061a 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -79,6 +79,7 @@ char *conf_get_default_confname(void); void sym_set_change_count(int count); void sym_add_change_count(int count); void conf_set_all_new_symbols(enum conf_def_mode mode); +void xfwrite(const void *xstr, size_t len, size_t count, FILE *output); /* kconfig_load.c */ void kconfig_load(void); -- Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html