DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test
@ 2015-01-16 14:27 Tomasz Kulasek
  2015-01-16 14:55 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Tomasz Kulasek @ 2015-01-16 14:27 UTC (permalink / raw)
  To: dev

The lack of result checking of fscanf function, brakes compilation for default 
"-Werror=unused-result" flag.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test
  2015-01-16 14:27 [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test Tomasz Kulasek
@ 2015-01-16 14:55 ` De Lara Guarch, Pablo
  2015-01-16 17:05   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2015-01-16 14:55 UTC (permalink / raw)
  To: Kulasek, TomaszX, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Friday, January 16, 2015 2:28 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test
> 
> The lack of result checking of fscanf function, brakes compilation for default
> "-Werror=unused-result" flag.
> 
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test
  2015-01-16 14:55 ` De Lara Guarch, Pablo
@ 2015-01-16 17:05   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-01-16 17:05 UTC (permalink / raw)
  To: Kulasek, TomaszX; +Cc: dev

> > The lack of result checking of fscanf function, brakes compilation for default
> > "-Werror=unused-result" flag.
> > 
> > Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-16 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 14:27 [dpdk-dev] [PATCH] librte_eal: Add fscanf return value test Tomasz Kulasek
2015-01-16 14:55 ` De Lara Guarch, Pablo
2015-01-16 17:05   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).