Changeset 250

Show
Ignore:
Timestamp:
04/14/08 15:15:34 (1 month ago)
Author:
timo
Message:

error handling in watchbsp (contributed by ilm)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • GtkRadiant/branches/ZeroRadiant/libs/l_net/l_net.c

    r183 r250  
    347347int Net_Setup(void) 
    348348{ 
    349         WINS_Init(); 
     349        if( !WINS_Init() ) 
     350                return qfalse; 
     351 
    350352        // 
    351353        WinPrint("my address is %s\n", WINS_MyAddress()); 
  • GtkRadiant/branches/ZeroRadiant/libs/l_net/l_net_berkeley.c

    r183 r250  
    176176        gethostname(buff, MAXHOSTNAMELEN); 
    177177        local = gethostbyname(buff); 
     178 
     179        // When hostname can not be resolved, return gracefully 
     180        if( local == 0 ) 
     181        { 
     182                WinError("WINS_Init: Unable to resolve hostname\n"); 
     183                return 0; 
     184        } 
     185 
    178186        myAddr = *(int *)local->h_addr_list[0]; 
    179187 
  • GtkRadiant/branches/ZeroRadiant/radiant/watchbsp.cpp

    r191 r250  
    306306#endif 
    307307  Sys_Printf("Setting up\n"); 
    308         Net_Setup(); 
    309         m_pListenSocket = Net_ListenSocket(39000); 
     308  if( !Net_Setup() ) 
     309    return false; 
     310 
     311  m_pListenSocket = Net_ListenSocket(39000); 
    310312  if (m_pListenSocket == NULL) 
    311313    return false; 
     314 
    312315  Sys_Printf("Listening...\n"); 
    313316  return true;