[ethtool] 10/20: ethtool.c: don't ignore fread() return value
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Mar 14 11:37:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository ethtool.
commit b41fe9eae9d0810dd6052f924373e2777f0f4270
Author: David Decotigny <decot at googlers.com>
Date: Fri Mar 11 09:58:15 2016 -0800
ethtool.c: don't ignore fread() return value
This addresses:
ethtool.c:1116:8: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: David Decotigny <decot at googlers.com>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
ethtool.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ethtool.c b/ethtool.c
index 50da85d..16a9865 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1007,6 +1007,7 @@ static int dump_regs(int gregs_dump_raw, int gregs_dump_hex,
if (gregs_dump_file) {
FILE *f = fopen(gregs_dump_file, "r");
struct stat st;
+ size_t nread;
if (!f || fstat(fileno(f), &st) < 0) {
fprintf(stderr, "Can't open '%s': %s\n",
@@ -1016,8 +1017,10 @@ static int dump_regs(int gregs_dump_raw, int gregs_dump_hex,
regs = realloc(regs, sizeof(*regs) + st.st_size);
regs->len = st.st_size;
- fread(regs->data, regs->len, 1, f);
+ nread = fread(regs->data, regs->len, 1, f);
fclose(f);
+ if (nread != 1)
+ return -1;
}
if (!gregs_dump_hex)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/ethtool.git
More information about the Kernel-svn-changes
mailing list