diff --git a/libs/l_net/l_net.c b/libs/l_net/l_net.c index 9ead665..a8a5957 100644 --- a/libs/l_net/l_net.c +++ b/libs/l_net/l_net.c @@ -346,7 +346,9 @@ void Net_MyAddress(address_t *address) //=========================================================================== int Net_Setup(void) { - WINS_Init(); + if( !WINS_Init() ) + return qfalse; + // WinPrint("my address is %s\n", WINS_MyAddress()); // diff --git a/libs/l_net/l_net_berkeley.c b/libs/l_net/l_net_berkeley.c index 2d4d33b..e7d0b96 100644 --- a/libs/l_net/l_net_berkeley.c +++ b/libs/l_net/l_net_berkeley.c @@ -175,6 +175,14 @@ int WINS_Init(void) // determine my name & address gethostname(buff, MAXHOSTNAMELEN); local = gethostbyname(buff); + + // When hostname can not be resolved, return gracefully + if( local == 0 ) + { + WinError("WINS_Init: Unable to resolve hostname\n"); + return 0; + } + myAddr = *(int *)local->h_addr_list[0]; // if the quake hostname isn't set, set it to the machine name diff --git a/radiant/watchbsp.cpp b/radiant/watchbsp.cpp index 314921a..2c85e57 100644 --- a/radiant/watchbsp.cpp +++ b/radiant/watchbsp.cpp @@ -305,10 +305,13 @@ bool CWatchBSP::SetupListening() } #endif Sys_Printf("Setting up\n"); - Net_Setup(); - m_pListenSocket = Net_ListenSocket(39000); + if( !Net_Setup() ) + return false; + + m_pListenSocket = Net_ListenSocket(39000); if (m_pListenSocket == NULL) return false; + Sys_Printf("Listening...\n"); return true; }