Fix linked list of ifaddrs in implementations of rep_getifaddrs.
authorMichael Adam <obnox@samba.org>
Thu, 21 Feb 2008 23:27:00 +0000 (00:27 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 21 Feb 2008 23:36:20 +0000 (00:36 +0100)
Produce proper list instead of one-node-loop.

Michael

source/lib/replace/getifaddrs.c

index 60049caa99050f878ac5b4610b1d6fa0c282d52f..37cd950e0979bfc9404c61145b3c2548efbba176 100644 (file)
@@ -115,7 +115,7 @@ int rep_getifaddrs(struct ifaddrs **ifap)
                if (lastif == NULL) {
                        *ifap = curif;
                } else {
-                       lastif->ifa_next = (*ifap);
+                       lastif->ifa_next = curif;
                }
 
                curif->ifa_name = strdup(ifr[i].ifr_name);
@@ -208,7 +208,7 @@ int rep_getifaddrs(struct ifaddrs **ifap)
                if (lastif == NULL) {
                        *ifap = curif;
                } else {
-                       lastif->ifa_next = (*ifap);
+                       lastif->ifa_next = curif;
                }
 
                strioctl.ic_cmd = SIOCGIFFLAGS;
@@ -306,7 +306,7 @@ int rep_getifaddrs(struct ifaddrs **ifap)
                if (lastif == NULL) {
                        *ifap = curif;
                } else {
-                       lastif->ifa_next = (*ifap);
+                       lastif->ifa_next = curif;
                }
 
                curif->ifa_name = strdup(ifr->ifr_name);