Report error when enabling IP forwarding
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Nov 2010 22:57:37 +0000 (07:57 +0900)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Nov 2010 22:57:37 +0000 (07:57 +0900)
src/tethering.c

index 04f3409..420a3ca 100644 (file)
@@ -86,11 +86,15 @@ static int enable_ip_forward(connman_bool_t enable)
 {
 
        FILE *f;
-       int ip_forward = enable ? 1 : 0;
 
        f = fopen("/proc/sys/net/ipv4/ip_forward", "r+");
+       if (f == NULL)
+               return -errno;
 
-       fprintf(f, "%d", ip_forward);
+       if (enable == TRUE)
+               fprintf(f, "1");
+       else
+               fprintf(f, "0");
 
        fclose(f);