[pisa-src] r1316 - trunk/pisasd/sdnat.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Tue, 27 Oct 2009 14:38:16 +0100

Author: tjansen
Date: Tue Oct 27 14:38:16 2009
New Revision: 1316

Log:
Fixed warnings:

sdnat.c: In function ‘pisa_forwarding_start’:
sdnat.c:40: warning: ignoring return value of ‘read’, declared with attribute 
warn_unused_result
sdnat.c:43: warning: ignoring return value of ‘write’, declared with attribute 
warn_unused_result
sdnat.c: In function ‘pisa_forwarding_stop’:
sdnat.c:66: warning: ignoring return value of ‘write’, declared with attribute 
warn_unused_result
sdnat.c: In function ‘pisa_sdnat_start’:
sdnat.c:81: warning: ignoring return value of ‘system’, declared with attribute 
warn_unused_result
sdnat.c: In function ‘pisa_sdnat_stop’:
sdnat.c:89: warning: ignoring return value of ‘system’, declared with attribute 
warn_unused_result

Modified:
   trunk/pisasd/sdnat.c

Modified: trunk/pisasd/sdnat.c
==============================================================================
--- trunk/pisasd/sdnat.c        Tue Oct 27 14:30:26 2009        (r1315)
+++ trunk/pisasd/sdnat.c        Tue Oct 27 14:38:16 2009        (r1316)
@@ -37,10 +37,12 @@
                return;
        }
 
-       read(fd, &value, 1);
+       if (read(fd, &value, 1) != 1)
+               PISA_ERROR("pisa_forwarding_start: failed to read the 
ip_forward status\n");
        if (value == '0') {
                PISA_DEBUG(PL_NAT, "Enabling ip_forwarding.\n");
-               write(fd, "1", 1);
+               if (write(fd, "1", 1) != 1)
+                       PISA_ERROR("pisa_forwarding_stop: failed to write the 
ip_forward status\n");
                sd_ctx.disable_ip4_forward = 1;
        }
 
@@ -63,7 +65,8 @@
        }
 
        PISA_DEBUG(PL_NAT, "Disabling ip_forwarding.\n");
-       write(fd, "0", 1);
+       if (write(fd, "0", 1) != 1);
+               PISA_ERROR("pisa_forwarding_stop: failed to write the 
ip_forward status\n");
        sd_ctx.disable_ip4_forward = 0;
 
        close(fd);
@@ -78,7 +81,8 @@
  */
 void pisa_sdnat_start(void)
 {
-       system(sd_cfg.nat_up);
+       if (system(sd_cfg.nat_up) < 0)
+               PISA_ERROR("pisa_sdnat_start failed\n");
 }
 
 /**
@@ -86,5 +90,6 @@
  */
 void pisa_sdnat_stop(void)
 {
-       system(sd_cfg.nat_down);
+       if (system(sd_cfg.nat_down) < 0)
+               PISA_ERROR("pisa_sdnat_stop failed\n");
 }

Other related posts:

  • » [pisa-src] r1316 - trunk/pisasd/sdnat.c - Thomas Jansen