svn commit: samba r25475 - in branches: SAMBA_3_2/source/lib SAMBA_3_2_0/source/lib

jra at samba.org jra at samba.org
Tue Oct 2 20:39:43 GMT 2007


Author: jra
Date: 2007-10-02 20:39:41 +0000 (Tue, 02 Oct 2007)
New Revision: 25475

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25475

Log:
Fix braindead mistakes I made pointed out by Simo and
James (how did this compile ? :-).
Jeremy.

Modified:
   branches/SAMBA_3_2/source/lib/interfaces.c
   branches/SAMBA_3_2_0/source/lib/interfaces.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/interfaces.c
===================================================================
--- branches/SAMBA_3_2/source/lib/interfaces.c	2007-10-02 20:04:14 UTC (rev 25474)
+++ branches/SAMBA_3_2/source/lib/interfaces.c	2007-10-02 20:39:41 UTC (rev 25475)
@@ -102,7 +102,7 @@
 	struct ifaddrs *ifptr = NULL;
 	int total = 0;
 
-	if (getifaddrs(&ifp) < 0) {
+	if (getifaddrs(&iflist) < 0) {
 		return -1;
 	}
 
@@ -111,6 +111,10 @@
 			ifptr != NULL && total < max_interfaces;
 			ifptr = ifptr->ifa_next) {
 
+		if (!ifptr->ifa_addr || !ifptr->ifa_netmask) {
+			continue;
+		}
+
 		/* Skip ipv6 for now. */
 		if (ifptr->ifa_addr->sa_family != AF_INET) {
 			continue;
@@ -125,7 +129,7 @@
 			((struct sockaddr_in *)ifptr->ifa_addr).sin_addr;
 
 		ifaces[total].iface_netmask.netmask =
-			((struct sockaddr_in *)ifptr->ifa_addr)->sin_addr;
+			((struct sockaddr_in *)ifptr->ifa_netmask)->sin_addr;
 
 		strncpy(ifaces[total].name, ifptr->ifa_name,
 				sizeof(ifaces[total].name)-1);

Modified: branches/SAMBA_3_2_0/source/lib/interfaces.c
===================================================================
--- branches/SAMBA_3_2_0/source/lib/interfaces.c	2007-10-02 20:04:14 UTC (rev 25474)
+++ branches/SAMBA_3_2_0/source/lib/interfaces.c	2007-10-02 20:39:41 UTC (rev 25475)
@@ -102,7 +102,7 @@
 	struct ifaddrs *ifptr = NULL;
 	int total = 0;
 
-	if (getifaddrs(&ifp) < 0) {
+	if (getifaddrs(&iflist) < 0) {
 		return -1;
 	}
 
@@ -111,6 +111,10 @@
 			ifptr != NULL && total < max_interfaces;
 			ifptr = ifptr->ifa_next) {
 
+		if (!ifptr->ifa_addr || !ifptr->ifa_netmask) {
+			continue;
+		}
+
 		/* Skip ipv6 for now. */
 		if (ifptr->ifa_addr->sa_family != AF_INET) {
 			continue;
@@ -125,7 +129,7 @@
 			((struct sockaddr_in *)ifptr->ifa_addr).sin_addr;
 
 		ifaces[total].iface_netmask.netmask =
-			((struct sockaddr_in *)ifptr->ifa_addr)->sin_addr;
+			((struct sockaddr_in *)ifptr->ifa_netmask)->sin_addr;
 
 		strncpy(ifaces[total].name, ifptr->ifa_name,
 				sizeof(ifaces[total].name)-1);



More information about the samba-cvs mailing list