don't zero out OtcpEvent structure from InitOskitTCP(), because it has already been initialized at this point. Also added a check for null to avoid crash in ifa_ifwithnet()

svn path=/trunk/; revision=10975
This commit is contained in:
Royce Mitchell III 2004-09-22 17:41:52 +00:00
parent bebf5b5e5e
commit b608a8ac83

View file

@ -1,3 +1,4 @@
#include <stdio.h>
#include <oskittcp.h> #include <oskittcp.h>
#include <oskitdebug.h> #include <oskitdebug.h>
#include <sys/param.h> #include <sys/param.h>
@ -56,7 +57,6 @@ void InitOskitTCP() {
tcp_init(); tcp_init();
OS_DbgPrint(OSK_MID_TRACE,("Init routing\n")); OS_DbgPrint(OSK_MID_TRACE,("Init routing\n"));
domaininit(); domaininit();
memset( &OtcpEvent, 0, sizeof( OtcpEvent ) );
OS_DbgPrint(OSK_MID_TRACE,("Init Finished\n")); OS_DbgPrint(OSK_MID_TRACE,("Init Finished\n"));
tcp_iss = 1024; tcp_iss = 1024;
} }
@ -455,9 +455,13 @@ struct ifaddr *ifa_ifwithnet(addr)
struct sockaddr_in *sin; struct sockaddr_in *sin;
struct ifaddr *ifaddr = ifa_iffind(addr, IFF_UNICAST); struct ifaddr *ifaddr = ifa_iffind(addr, IFF_UNICAST);
if( ifaddr )
{
sin = (struct sockaddr *)&ifaddr->ifa_addr; sin = (struct sockaddr *)&ifaddr->ifa_addr;
OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n", sin->sin_addr.s_addr)); OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n",
sin->sin_addr.s_addr));
}
return ifaddr; return ifaddr;
} }