From patchwork Sun Jul 11 18:17:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 111336 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6BIHqYk024974 for ; Sun, 11 Jul 2010 18:17:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754146Ab0GKSRv (ORCPT ); Sun, 11 Jul 2010 14:17:51 -0400 Received: from cantor.suse.de ([195.135.220.2]:58087 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754191Ab0GKSRv (ORCPT ); Sun, 11 Jul 2010 14:17:51 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 465E393A00; Sun, 11 Jul 2010 20:17:50 +0200 (CEST) Date: Sun, 11 Jul 2010 20:17:45 +0200 (CEST) From: Jiri Kosina To: Jean Sacren Cc: Roman Zippel , linux-kbuild@vger.kernel.org, Michal Marek Subject: Re: [PATCH 1/1] kconfig: Fix ignoring return value warning In-Reply-To: <20100709213909.GB25647@mail.gmail.com> Message-ID: References: <20100709213909.GB25647@mail.gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 11 Jul 2010 18:17:52 +0000 (UTC) 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);