From patchwork Fri Jan 16 14:27:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Kulasek X-Patchwork-Id: 2332 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 884A65A97; Fri, 16 Jan 2015 15:28:29 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 6205D5A95 for ; Fri, 16 Jan 2015 15:28:28 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 16 Jan 2015 06:24:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,411,1418112000"; d="scan'208";a="671078381" Received: from unknown (HELO Sent) ([10.217.248.167]) by orsmga002.jf.intel.com with SMTP; 16 Jan 2015 06:28:25 -0800 Received: by Sent (sSMTP sendmail emulation); Fri, 16 Jan 2015 15:28:24 +0200 From: Tomasz Kulasek To: dev@dpdk.org Date: Fri, 16 Jan 2015 15:27:52 +0100 Message-Id: <1421418472-4640-1-git-send-email-tomaszx.kulasek@intel.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The lack of result checking of fscanf function, brakes compilation for default "-Werror=unused-result" flag. Signed-off-by: Tomasz Kulasek Acked-by: Pablo de Lara --- lib/librte_eal/linuxapp/eal/eal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 648ef81..f99e158 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -865,6 +865,7 @@ rte_eal_check_module(const char *module_name) { char mod_name[30]; /* Any module names can be longer than 30 bytes? */ int ret = 0; + int n; if (NULL == module_name) return -1; @@ -876,8 +877,8 @@ rte_eal_check_module(const char *module_name) return -1; } while (!feof(fd)) { - fscanf(fd, "%29s %*[^\n]", mod_name); - if (!strcmp(mod_name, module_name)) { + n = fscanf(fd, "%29s %*[^\n]", mod_name); + if ((n == 1) && !strcmp(mod_name, module_name)) { ret = 1; break; }