From: Tomasz Kulasek Date: Fri, 16 Jan 2015 14:27:52 +0000 (+0100) Subject: eal/linux: check fscanf return when parsing modules list X-Git-Tag: spdx-start~9848 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b4f60f55570468619100552b4e1fa96e337826f6;p=dpdk.git eal/linux: check fscanf return when parsing modules list The lack of result checking of fscanf function, breaks compilation for default "-Werror=unused-result" flag. Signed-off-by: Tomasz Kulasek Acked-by: Pablo de Lara --- diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 648ef81401..f99e158638 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; }