]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Silence bogus gcc messages.
authorRoy Marples <roy@marples.name>
Wed, 5 Jun 2013 17:19:07 +0000 (17:19 +0000)
committerRoy Marples <roy@marples.name>
Wed, 5 Jun 2013 17:19:07 +0000 (17:19 +0000)
dhcp-common.c
dhcp6.c

index d8c5ae62d9e0cc531e2122596025b2aa227b32ba..7b217f94d4cef7353ad02321d296e463a1ddba5c 100644 (file)
@@ -99,10 +99,15 @@ encode_rfc1035(const char *src, uint8_t *dst)
 
        if (src == NULL || *src == '\0')
                return 0;
+
        if (dst) {
                p = dst;
                lp = p++;
        }
+       /* Silence bogus GCC warnings */
+       else
+               p = lp = NULL;
+
        len = 1;
        has_dot = 0;
        for (; *src; src++) {
@@ -123,13 +128,16 @@ encode_rfc1035(const char *src, uint8_t *dst)
                        *p++ = (uint8_t)*src;
                len++;
        }
+
        if (dst) {
                *lp = p - lp - 1;
                if (has_dot)
                        *p++ = '\0';
        }
+
        if (has_dot)
                len++;
+
        return len;
 }
 
diff --git a/dhcp6.c b/dhcp6.c
index b0fe4393bd99dccb245d6b50f7ff92bea570f182..ecff6e2dfe7dd878151df43cbf34b50240fa365a 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -362,7 +362,7 @@ dhcp6_makemessage(struct interface *ifp)
        uint8_t IA, *p;
        uint32_t u32;
        const struct ipv6_addr *ap;
-       const char *hostname;
+       const char *hostname = NULL; /* assignment just to appease GCC*/
 
        state = D6_STATE(ifp);
        if (state->send) {