summaryrefslogtreecommitdiff
path: root/zebra/ipforward_proc.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2011-12-07 00:09:56 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2012-01-02 17:15:55 +0400
commit7e7a2d38b2d5d5edd3be7d6754d67c3231ee215e (patch)
treee50e725a1b472ba7db5f33b490786b4c1c1149f4 /zebra/ipforward_proc.c
parent8502229b7ed198d994017e4fd04000d429ca9c8d (diff)
zebra: fix warnings in forward proc
Check result of fgets(), and don't set variable that is never used.
Diffstat (limited to 'zebra/ipforward_proc.c')
-rw-r--r--zebra/ipforward_proc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c
index 73846137..2876eded 100644
--- a/zebra/ipforward_proc.c
+++ b/zebra/ipforward_proc.c
@@ -45,7 +45,6 @@ ipforward (void)
{
FILE *fp;
int ipforwarding = 0;
- char *pnt;
char buf[10];
fp = fopen (proc_net_snmp, "r");
@@ -59,8 +58,8 @@ ipforward (void)
/* Get ip_statistics.IpForwarding :
1 => ip forwarding enabled
2 => ip forwarding off. */
- pnt = fgets (buf, 6, fp);
- sscanf (buf, "Ip: %d", &ipforwarding);
+ if (fgets (buf, 6, fp))
+ sscanf (buf, "Ip: %d", &ipforwarding);
fclose(fp);
@@ -140,8 +139,8 @@ ipforward_ipv6 (void)
if (fp == NULL)
return -1;
- fgets (buf, 2, fp);
- sscanf (buf, "%d", &ipforwarding);
+ if (fgets (buf, 2, fp))
+ sscanf (buf, "%d", &ipforwarding);
fclose (fp);
return ipforwarding;