options: fix parsing of boolean attributes
[project/firewall3.git] / defaults.c
index 6c3ec9dd6965a5754d370c3197eb891004ccf1b0..0580bfccccf0e5d4fb9b7704b2f405374cae015d 100644 (file)
@@ -218,7 +218,7 @@ fw3_print_default_head_rules(struct fw3_ipt_handle *handle,
 {
        int i;
        struct fw3_defaults *defs = &state->defaults;
-       struct fw3_device lodev = { .set = true };
+       struct fw3_device lodev = { .set = true, .name = "lo" };
        struct fw3_protocol tcp = { .protocol = 6 };
        struct fw3_ipt_rule *r;
 
@@ -232,8 +232,6 @@ fw3_print_default_head_rules(struct fw3_ipt_handle *handle,
        {
        case FW3_TABLE_FILTER:
 
-               sprintf(lodev.name, "lo");
-
                r = fw3_ipt_rule_create(handle, NULL, &lodev, NULL, NULL, NULL);
                fw3_ipt_rule_target(r, "ACCEPT");
                fw3_ipt_rule_append(r, "INPUT");
@@ -378,7 +376,7 @@ static void
 set_default(const char *name, int set)
 {
        FILE *f;
-       char path[sizeof("/proc/sys/net/ipv4/tcp_window_scaling\0")];
+       char path[sizeof("/proc/sys/net/ipv4/tcp_window_scaling")];
 
        snprintf(path, sizeof(path), "/proc/sys/net/ipv4/tcp_%s", name);