From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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: , X-List-Received-Date: Fri, 16 Jan 2015 14:28:28 -0000 The lack of result checking of fscanf function, brakes compilation for default "-Werror=unused-result" flag. Signed-off-by: Tomasz Kulasek --- 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; } -- 1.7.9.5 -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.