Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:GA
iproute2
avoid-unused-return-value-gcc-warnings.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File avoid-unused-return-value-gcc-warnings.patch of Package iproute2
From: Michal Kubecek <mkubecek@suse.cz> Date: Thu, 5 Dec 2013 14:04:31 +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 ++++-- misc/ifstat.c | 6 ++++-- misc/lnstat_util.c | 11 +++++++---- misc/nstat.c | 6 ++++-- misc/ss.c | 44 +++++++++++++++++++++++++++++--------------- netem/maketable.c | 3 ++- 6 files changed, 50 insertions(+), 26 deletions(-) diff --git a/ip/rtmon.c b/ip/rtmon.c index 9227eac..b997afa 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 = 15; 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 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/misc/ifstat.c b/misc/ifstat.c index a47c046..60217a4 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -807,8 +807,9 @@ int main(int argc, char *argv[]) fclose(tfp); } if (uptime >= 0 && time(NULL) >= stb.st_mtime+uptime) { + int res = 0; fprintf(stderr, "ifstat: history is aged out, resetting\n"); - ftruncate(fileno(hist_fp), 0); + res = ftruncate(fileno(hist_fp), 0); } } @@ -851,7 +852,8 @@ int main(int argc, char *argv[]) } if (!no_update) { - ftruncate(fileno(hist_fp), 0); + int res = 0; + res = ftruncate(fileno(hist_fp), 0); rewind(hist_fp); json_output = 0; diff --git a/misc/lnstat_util.c b/misc/lnstat_util.c index 9492baf..9593d94 100644 --- a/misc/lnstat_util.c +++ b/misc/lnstat_util.c @@ -46,10 +46,11 @@ static int scan_lines(struct lnstat_file *lf, int i) while(!feof(lf->fp)) { char buf[FGETS_BUF_SIZE]; char *ptr = buf; + char *res; num_lines++; - fgets(buf, sizeof(buf)-1, lf->fp); + res = fgets(buf, sizeof(buf)-1, lf->fp); gettimeofday(&lf->last_read, NULL); for (j = 0; j < lf->num_fields; j++) { @@ -90,11 +91,12 @@ int lnstat_update(struct lnstat_file *lnstat_files) if (time_after(&lf->last_read, &lf->interval, &tv)) { int i; struct lnstat_field *lfi; + char *res; rewind(lf->fp); if (!lf->compat) { /* skip first line */ - fgets(buf, sizeof(buf)-1, lf->fp); + res = fgets(buf, sizeof(buf)-1, lf->fp); } scan_lines(lf, 1); @@ -108,7 +110,7 @@ int lnstat_update(struct lnstat_file *lnstat_files) } rewind(lf->fp); - fgets(buf, sizeof(buf)-1, lf->fp); + res = fgets(buf, sizeof(buf)-1, lf->fp); scan_lines(lf, 0); } } @@ -140,9 +142,10 @@ static int __lnstat_scan_fields(struct lnstat_file *lf, char *buf) static int lnstat_scan_fields(struct lnstat_file *lf) { char buf[FGETS_BUF_SIZE]; + char *res; rewind(lf->fp); - fgets(buf, sizeof(buf)-1, lf->fp); + res = fgets(buf, sizeof(buf)-1, lf->fp); return __lnstat_scan_fields(lf, buf); } diff --git a/misc/nstat.c b/misc/nstat.c index d3f8621..6b1a248 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -624,8 +624,9 @@ int main(int argc, char *argv[]) fclose(tfp); } if (uptime >= 0 && time(NULL) >= stb.st_mtime+uptime) { + int res = 0; fprintf(stderr, "nstat: history is aged out, resetting\n"); - ftruncate(fileno(hist_fp), 0); + res = ftruncate(fileno(hist_fp), 0); } } @@ -669,7 +670,8 @@ int main(int argc, char *argv[]) dump_incr_db(stdout); } if (!no_update) { - ftruncate(fileno(hist_fp), 0); + int res = 0; + res = ftruncate(fileno(hist_fp), 0); rewind(hist_fp); json_output = 0; diff --git a/misc/ss.c b/misc/ss.c index 6f38ae7..0e09603 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -302,7 +302,8 @@ static void user_ent_hash_build(void) snprintf(tmp, sizeof(tmp), "%s/%d/stat", root, pid); if ((fp = fopen(tmp, "r")) != NULL) { - fscanf(fp, "%*d (%[^)])", process); + int res = 0; + res = fscanf(fp, "%*d (%[^)])", process); fclose(fp); } } @@ -375,6 +376,7 @@ static int get_slabstat(struct slabstat *s) char buf[256]; FILE *fp; int cnt; + char *res; memset(s, 0, sizeof(*s)); @@ -384,7 +386,7 @@ static int get_slabstat(struct slabstat *s) cnt = sizeof(*s)/sizeof(int); - fgets(buf, sizeof(buf), fp); + res = fgets(buf, sizeof(buf), fp); while(fgets(buf, sizeof(buf), fp) != NULL) { int i; for (i=0; i<sizeof(slabstat_ids)/sizeof(slabstat_ids[0]); i++) { @@ -508,7 +510,8 @@ static void init_service_resolver(void) char buf[128]; FILE *fp = popen("/usr/sbin/rpcinfo -p 2>/dev/null", "r"); if (fp) { - fgets(buf, sizeof(buf), fp); + char *res; + res = fgets(buf, sizeof(buf), fp); while (fgets(buf, sizeof(buf), fp) != NULL) { unsigned int progn, port; char proto[128], prog[128]; @@ -547,8 +550,9 @@ static int is_ephemeral(int port) if (!ip_local_port_min) { FILE *f = ephemeral_ports_open(); if (f) { - fscanf(f, "%d %d", - &ip_local_port_min, &ip_local_port_max); + int res = 0; + res = fscanf(f, "%d %d", + &ip_local_port_min, &ip_local_port_max); fclose(f); } else { ip_local_port_min = 1024; @@ -725,7 +729,8 @@ static int run_ssfilter(struct ssfilter *f, struct tcpstat *s) if (!low) { FILE *fp = ephemeral_ports_open(); if (fp) { - fscanf(fp, "%d%d", &low, &high); + int res = 0; + res = fscanf(fp, "%d%d", &low, &high); fclose(fp); } } @@ -1717,8 +1722,10 @@ again: return 0; } - if (dump_fp) - fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp); + if (dump_fp) { + size_t res = 0; + res = fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp); + } h = (struct nlmsghdr*)buf; while (NLMSG_OK(h, status)) { @@ -2277,8 +2284,10 @@ static int handle_netlink_request(struct filter *f, FILE *dump_fp, goto close_it; } - if (dump_fp) - fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp); + if (dump_fp) { + size_t res = 0; + res = fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp); + } h = (struct nlmsghdr*)buf; while (NLMSG_OK(h, status)) { @@ -2357,6 +2366,7 @@ static int unix_show(struct filter *f) int newformat = 0; int cnt; struct unixstat *list = NULL; + char *res; if (!getenv("PROC_NET_UNIX") && !getenv("PROC_ROOT") && unix_show_netlink(f, NULL) == 0) @@ -2364,7 +2374,7 @@ static int unix_show(struct filter *f) if ((fp = net_unix_open()) == NULL) return -1; - fgets(buf, sizeof(buf)-1, fp); + res = fgets(buf, sizeof(buf)-1, fp); if (memcmp(buf, "Peer", 4) == 0) newformat = 1; @@ -2560,8 +2570,10 @@ static int packet_show_netlink(struct filter *f, FILE *dump_fp) goto close_it; } - if (dump_fp) - fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp); + if (dump_fp) { + size_t res = 0; + res = fwrite(buf, 1, NLMSG_ALIGN(status), dump_fp); + } h = (struct nlmsghdr*)buf; while (NLMSG_OK(h, status)) { @@ -2621,6 +2633,7 @@ static int packet_show(struct filter *f) int uid; int ino; unsigned long long sk; + char *res; if (!(f->states & (1<<SS_CLOSE))) return 0; @@ -2630,7 +2643,7 @@ static int packet_show(struct filter *f) if ((fp = net_packet_open()) == NULL) return -1; - fgets(buf, sizeof(buf)-1, fp); + res = fgets(buf, sizeof(buf)-1, fp); while (fgets(buf, sizeof(buf)-1, fp)) { sscanf(buf, "%llx %*d %d %x %d %d %u %u %u", @@ -2826,6 +2839,7 @@ static int netlink_show(struct filter *f) unsigned groups; int rq, wq, rc; unsigned long long sk, cb; + char *res; if (!(f->states & (1<<SS_CLOSE))) return 0; @@ -2836,7 +2850,7 @@ static int netlink_show(struct filter *f) if ((fp = net_netlink_open()) == NULL) return -1; - fgets(buf, sizeof(buf)-1, fp); + res = fgets(buf, sizeof(buf)-1, fp); while (fgets(buf, sizeof(buf)-1, fp)) { sscanf(buf, "%llx %d %d %x %d %d %llx %d", diff --git a/netem/maketable.c b/netem/maketable.c index a5452b6..e4170b5 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; -- 1.8.1.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor