From patchwork Wed Aug 4 22:03:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?J=CE=B5an_Sacren?= X-Patchwork-Id: 117157 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 o74M39rV008640 for ; Wed, 4 Aug 2010 22:03:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756437Ab0HDWDI (ORCPT ); Wed, 4 Aug 2010 18:03:08 -0400 Received: from mail-px0-f174.google.com ([209.85.212.174]:33675 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756408Ab0HDWDH (ORCPT ); Wed, 4 Aug 2010 18:03:07 -0400 Received: by pxi14 with SMTP id 14so2226100pxi.19 for ; Wed, 04 Aug 2010 15:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition; bh=RpgS73D3wqH4FTAmTcLX0MbEBEJ4vMxyfOY0xFGRSvw=; b=WZMLuX6NQd8UGz4eUPRfndGjiNiggrtQX7xk6CveUodxVwmTnsr0tm/bmr6x0uXXjI LBItO9iiOpeV8UJADd49c0kv8V29RFNOhoJRAe6iy40NAewNwbV3E+qFh0GqnoU0seEU 6bhoPqcD4eKkR91q0rxiod6tVPUXZ9DF7Ie/Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition; b=JG9S2QQyC7pFd+y8HGReF1VlE/Fv+QZrmMkR1P6ORVzGh/iYxT/QotQdusr8MUGY7X 4mNq0MDCGso49luUUzVZgMd21UlklX4iwPIKqSSIjynqyrXo19NlahPIcpHDbZ+w/B41 13qxtx61FFktB3VW33fm6Byr4DpZcccwY5Vw0= Received: by 10.142.204.17 with SMTP id b17mr8417226wfg.71.1280959386519; Wed, 04 Aug 2010 15:03:06 -0700 (PDT) Received: from localhost ([65.181.55.156]) by mx.google.com with ESMTPS id x18sm11039105wfd.20.2010.08.04.15.03.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Aug 2010 15:03:05 -0700 (PDT) Date: Wed, 4 Aug 2010 16:03:16 -0600 From: Jean Sacren To: Michal Marek Cc: Jiri Kosina , Roman Zippel , linux-kbuild@vger.kernel.org Subject: [PATCH 2/2] kconfig: Fix warning: ignoring return value of 'fgets' Message-ID: <20100804220316.GA10547@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline 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]); Wed, 04 Aug 2010 22:03:09 +0000 (UTC) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 9960d1c..692d459 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -102,7 +102,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) check_stdin(); case ask_all: fflush(stdout); - fgets(line, 128, stdin); + xfgets(line, 128, stdin); return 1; default: break; @@ -304,7 +304,7 @@ static int conf_choice(struct menu *menu) check_stdin(); case ask_all: fflush(stdout); - fgets(line, 128, stdin); + xfgets(line, 128, stdin); strip(line); if (line[0] == '?') { print_help(menu); @@ -615,3 +615,14 @@ int main(int ac, char **av) } return 0; } +/* + * Helper function to facilitate fgets() by Jean Sacren. + */ +void xfgets(str, size, in) + char *str; + int size; + FILE *in; +{ + if (fgets(str, size, in) == NULL) + fprintf(stderr, "\nError in reading or end of file.\n"); +} diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 90fe55a..c9bd96f 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -72,6 +72,9 @@ void zconf_nextfile(const char *name); int zconf_lineno(void); char *zconf_curname(void); +/* conf.c */ +void xfgets(char *str, int size, FILE *in); + /* confdata.c */ const char *conf_get_configname(void); const char *conf_get_autoconfig_name(void);