File avoid-unused-return-value-gcc-warnings.patch of Package iproute2.7171
From: Michal Kubecek <mkubecek@suse.cz>
Date: Fri, 15 Jan 2016 07:47:24 +0100
Subject: avoid "unused return value" gcc warnings
Patch-mainline: No
Avoid gcc warnings about unused return values of some functions.
These warnings are considered fatal by BuildService checks so
that we must avoid them in SLE packages even if only by
assigning the return value to a variable which we never use.
---
ip/rtmon.c | 6 ++++--
netem/maketable.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ip/rtmon.c b/ip/rtmon.c
index 42b24fb5fd38..b4b0235b67c5 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -33,6 +33,7 @@ static void write_stamp(FILE *fp)
char buf[128];
struct nlmsghdr *n1 = (void*)buf;
struct timeval tv;
+ size_t res;
n1->nlmsg_type = NLMSG_TSTAMP;
n1->nlmsg_flags = 0;
@@ -42,16 +43,17 @@ static void write_stamp(FILE *fp)
gettimeofday(&tv, NULL);
((__u32*)NLMSG_DATA(n1))[0] = tv.tv_sec;
((__u32*)NLMSG_DATA(n1))[1] = tv.tv_usec;
- fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
+ res = fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
}
static int dump_msg(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
+ size_t res;
if (!init_phase)
write_stamp(fp);
- fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
+ res = fwrite((void*)n, 1, NLMSG_ALIGN(n->nlmsg_len), fp);
fflush(fp);
return 0;
}
diff --git a/netem/maketable.c b/netem/maketable.c
index a5452b61730c..e4170b506522 100644
--- a/netem/maketable.c
+++ b/netem/maketable.c
@@ -38,7 +38,8 @@ readdoubles(FILE *fp, int *number)
}
for (i=0; i<limit; ++i){
- fscanf(fp, "%lf", &x[i]);
+ int res = 0;
+ res = fscanf(fp, "%lf", &x[i]);
if (feof(fp))
break;
++n;
--
2.7.0