]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Tidy some INET only and INET6 only warnings.
authorRoy Marples <roy@marples.name>
Fri, 28 Feb 2014 11:02:32 +0000 (11:02 +0000)
committerRoy Marples <roy@marples.name>
Fri, 28 Feb 2014 11:02:32 +0000 (11:02 +0000)
if-options.c
script.c

index eaafefbe7eba60f218868cf8b7a05a2de87e9cad..3c3acce79d604ff20a9894d252fb2fb0f31844f9 100644 (file)
@@ -629,6 +629,9 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
 
        dop = NULL;
        dop_len = NULL;
+#ifdef INET6
+       i = 0;
+#endif
        switch(opt) {
        case 'f': /* FALLTHROUGH */
        case 'g': /* FALLTHROUGH */
index ce12bade08366e63c5ec79371c62f613580f3e10..3bdf82a69ef8ff6cea5d0ec076e8b3b817f153c5 100644 (file)
--- a/script.c
+++ b/script.c
@@ -221,32 +221,46 @@ make_env(const struct interface *ifp, const char *reason, char ***argv)
        ssize_t e, elen, l;
        const struct if_options *ifo = ifp->options;
        const struct interface *ifp2;
-       int dhcp, dhcp6, ra;
+#ifdef INET
+       int dhcp;
        const struct dhcp_state *state;
+#endif
 #ifdef INET6
        const struct dhcp6_state *d6_state;
+       int dhcp6, ra;
 #endif
 
-       dhcp = dhcp6 = ra = 0;
+#ifdef INET
+       dhcp = 0;
        state = D_STATE(ifp);
+#endif
 #ifdef INET6
+       dhcp6 = ra = 0;
        d6_state = D6_CSTATE(ifp);
 #endif
        if (strcmp(reason, "TEST") == 0) {
+               if (1 == 2) {}
 #ifdef INET6
-               if (d6_state && d6_state->new)
+               else if (d6_state && d6_state->new)
                        dhcp6 = 1;
                else if (ipv6nd_has_ra(ifp))
                        ra = 1;
-               else
 #endif
+#ifdef INET
+               else
                        dhcp = 1;
-       } else if (reason[strlen(reason) - 1] == '6')
+#endif
+       }
+#ifdef INET6
+       else if (reason[strlen(reason) - 1] == '6')
                dhcp6 = 1;
        else if (strcmp(reason, "ROUTERADVERT") == 0)
                ra = 1;
+#endif
+#ifdef INET
        else
                dhcp = 1;
+#endif
 
        /* When dumping the lease, we only want to report interface and
           reason - the other interface variables are meaningless */
@@ -303,7 +317,10 @@ make_env(const struct interface *ifp, const char *reason, char ***argv)
        if (strcmp(reason, "TEST") == 0) {
                env[9] = strdup("if_up=false");
                env[10] = strdup("if_down=false");
-       } else if ((dhcp && state && state->new)
+       } else if (1 == 2 /* appease ifdefs */
+#ifdef INET
+           || (dhcp && state && state->new)
+#endif
 #ifdef INET6
            || (dhcp6 && d6_state && d6_state->new)
            || (ra && ipv6nd_has_ra(ifp))