diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-12-10 17:04:26 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-12-10 17:04:32 -0500 |
commit | ca46fb15bf39d8307c1d7741278e1b6f33de584c (patch) | |
tree | 2f72221a68b91c6624b9858965eacf953d393ffa | |
parent | 153ab835ebcd3387f09a433fd1b2e0c711277e23 (diff) | |
download | net-tools-ca46fb15bf39d8307c1d7741278e1b6f33de584c.tar.gz net-tools-ca46fb15bf39d8307c1d7741278e1b6f33de584c.tar.bz2 net-tools-ca46fb15bf39d8307c1d7741278e1b6f33de584c.zip |
ignore return value of fgets calls we dont care about
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | ipmaddr.c | 3 | ||||
-rw-r--r-- | iptunnel.c | 6 | ||||
-rw-r--r-- | lib/ax25_gr.c | 3 | ||||
-rw-r--r-- | lib/ddp_gr.c | 3 | ||||
-rw-r--r-- | lib/interface.c | 6 | ||||
-rw-r--r-- | lib/ipx_gr.c | 3 | ||||
-rw-r--r-- | lib/netrom_gr.c | 6 | ||||
-rw-r--r-- | lib/rose_gr.c | 3 | ||||
-rw-r--r-- | lib/x25_gr.c | 3 | ||||
-rw-r--r-- | netstat.c | 9 |
10 files changed, 30 insertions, 15 deletions
@@ -181,7 +181,8 @@ void read_igmp(struct ma_info **result_p) if (!fp) return; memset(&m, 0, sizeof(m)); - fgets(buf, sizeof(buf), fp); + if (fgets(buf, sizeof(buf), fp)) + /* eat line */; m.addr.family = AF_INET; m.addr.bitlen = 32; @@ -476,8 +476,10 @@ static int do_tunnels_list(struct ip_tunnel_parm *p) return -1; } - fgets(buf, sizeof(buf), fp); - fgets(buf, sizeof(buf), fp); + if (fgets(buf, sizeof(buf), fp)) + /* eat line */; + if (fgets(buf, sizeof(buf), fp)) + /* eat line */; while (fgets(buf, sizeof(buf), fp) != NULL) { char *ptr; diff --git a/lib/ax25_gr.c b/lib/ax25_gr.c index 4dce92d..46a67ee 100644 --- a/lib/ax25_gr.c +++ b/lib/ax25_gr.c @@ -49,7 +49,8 @@ int AX25_rprint(int options) } printf(_("Kernel AX.25 routing table\n")); /* xxx */ printf(_("Destination Iface Use\n")); /* xxx */ - fgets(buffer, 256, f); + if (fgets(buffer, 256, f)) + /* eat line */; while (fgets(buffer, 256, f)) { buffer[9] = 0; buffer[14] = 0; diff --git a/lib/ddp_gr.c b/lib/ddp_gr.c index 3453e2f..c99dc0d 100644 --- a/lib/ddp_gr.c +++ b/lib/ddp_gr.c @@ -73,7 +73,8 @@ int DDP_rprint(int options) return 1; } - fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev); + if (fscanf(fp, "%as %as %as %as\n", &dest, &gw, &flags, &dev)) + /* eat line */; free(dest); free(gw); free(dev); free(flags); printf("%s\n", hdr); diff --git a/lib/interface.c b/lib/interface.c index 0e5e454..276c5f5 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -326,8 +326,10 @@ static int if_readlist_proc(char *target) _PATH_PROCNET_DEV, strerror(errno)); return -2; } - fgets(buf, sizeof buf, fh); /* eat line */ - fgets(buf, sizeof buf, fh); + if (fgets(buf, sizeof buf, fh)) + /* eat line */; + if (fgets(buf, sizeof buf, fh)) + /* eat line */; #if 0 /* pretty, but can't cope with missing fields */ fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, diff --git a/lib/ipx_gr.c b/lib/ipx_gr.c index 96fac80..7cb4c5e 100644 --- a/lib/ipx_gr.c +++ b/lib/ipx_gr.c @@ -62,7 +62,8 @@ int IPX_rprint(int options) printf(_("Kernel IPX routing table\n")); /* xxx */ printf(_("Destination Router Net Router Node\n")); - fgets(buff, 1023, fp); + if (fgets(buff, 1023, fp)) + /* eat line */; while (fgets(buff, 1023, fp)) { num = sscanf(buff, "%s %s %s", net, router_net, router_node); diff --git a/lib/netrom_gr.c b/lib/netrom_gr.c index adf54b2..9e9e6e9 100644 --- a/lib/netrom_gr.c +++ b/lib/netrom_gr.c @@ -50,7 +50,8 @@ int NETROM_rprint(int options) } printf(_("Kernel NET/ROM routing table\n")); printf(_("Destination Mnemonic Quality Neighbour Iface\n")); - fgets(buffer, 256, f1); + if (fgets(buffer, 256, f1)) + /* eat line */; while (fgets(buffer, 256, f1)) { buffer[9] = 0; buffer[17] = 0; @@ -60,7 +61,8 @@ int NETROM_rprint(int options) qual = atoi(buffer + 24 + 15 * w); n = atoi(buffer + 32 + 15 * w); rewind(f2); - fgets(buffer, 256, f2); + if (fgets(buffer, 256, f2)) + /* eat line */; while (fgets(buffer, 256, f2)) { if (atoi(buffer) == n) { buffer[15] = 0; diff --git a/lib/rose_gr.c b/lib/rose_gr.c index cf0a60a..a0858fd 100644 --- a/lib/rose_gr.c +++ b/lib/rose_gr.c @@ -53,7 +53,8 @@ int ROSE_rprint(int options) } printf(_("Kernel ROSE routing table\n")); printf(_("Destination Iface Use\n")); - fgets(buffer, 256, f); + if (fgets(buffer, 256, f)) + /* eat line */; while (fgets(buffer, 256, f)) { buffer[9] = 0; buffer[14] = 0; diff --git a/lib/x25_gr.c b/lib/x25_gr.c index 187fc05..35843ed 100644 --- a/lib/x25_gr.c +++ b/lib/x25_gr.c @@ -62,7 +62,8 @@ int X25_rprint(int options) } printf( _("Kernel X.25 routing table\n")); /* xxx */ printf( _("Destination Iface\n")); /* xxx */ - fgets(buffer,256,f); + if (fgets(buffer,256,f)) + /* eat line */; while(fgets(buffer,256,f)) { p = strchr(buffer,'\n'); @@ -478,7 +478,8 @@ static int netrom_info(void) } printf(_("Active NET/ROM sockets\n")); printf(_("User Dest Source Device State Vr/Vs Send-Q Recv-Q\n")); - fgets(buffer, 256, f); + if (fgets(buffer, 256, f)) + /* eat line */; while (fgets(buffer, 256, f)) { buffer[9] = 0; @@ -686,7 +687,8 @@ static int x25_info(void) printf( _("Active X.25 sockets\n")); /* IMHO, Vr/Vs is not very usefull --SF */ printf( _("Dest Source Device LCI State Vr/Vs Send-Q Recv-Q\n")); - fgets(buffer,256,f); + if (fgets(buffer,256,f)) + /* eat line */; while(fgets(buffer,256,f)) { buffer[10]=0; @@ -1541,7 +1543,8 @@ static int ipx_info(void) EINTERN("netstat.c", "AF_IPX missing"); return (-1); } - fgets(buf, 255, f); + if (fgets(buf, 255, f)) + /* eat line */; while (fgets(buf, 255, f) != NULL) { sscanf(buf, "%s %s %lX %lX %d %d", |