]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Solaris: Improve prior
authorRoy Marples <roy@marples.name>
Wed, 4 Sep 2019 03:38:22 +0000 (06:38 +0300)
committerRoy Marples <roy@marples.name>
Wed, 4 Sep 2019 03:38:22 +0000 (06:38 +0300)
src/if-sun.c

index 63b2c11c6c435298c070766151e5f02584964daf..6d101941af940b5e7f8f28ba1624c593352af98e 100644 (file)
@@ -445,11 +445,15 @@ if_getifaddrs(struct ifaddrs **ifap)
                        continue;
 
                /* Total hack */
-               ifa->ifa_dstaddr = malloc(sizeof(struct sockaddr_storage));
+               ifa->ifa_dstaddr = malloc(sizeof(struct sockaddr_in6));
                if (ifa->ifa_dstaddr == NULL)
                        continue;
-               if_getsubnet(fd, ifa->ifa_name,
-                   ifa->ifa_dstaddr, sizeof(struct sockaddr_storage));
+               if (if_getsubnet(fd, ifa->ifa_name,
+                   ifa->ifa_dstaddr, sizeof(struct sockaddr_in6) == -1))
+               {
+                       free(ifa->ifa_dstaddr);
+                       ifa->ifa_dstaddr = NULL;
+               }
        }
        close(fd);
 #endif