X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=libs%2Fl_net%2Fl_net_wins.c;h=937e7abb9cb52dc772a3f15a3f7ec4d93a160302;hb=83113718a4fb6a8e2318841f16f8a0b0eb85675c;hp=ca888259530f225422dcf7a9a57108ea0bd9e2f7;hpb=62d99f889c0e98be65f779d3983109c84ce58cec;p=xonotic%2Fnetradiant.git diff --git a/libs/l_net/l_net_wins.c b/libs/l_net/l_net_wins.c index ca888259..937e7abb 100644 --- a/libs/l_net/l_net_wins.c +++ b/libs/l_net/l_net_wins.c @@ -40,22 +40,19 @@ #define WinError WinPrint -#define qtrue 1 -#define qfalse 0 - typedef struct tag_error_struct { int errnum; LPSTR errstr; } ERROR_STRUCT; -#define NET_NAMELEN 64 +const int NET_NAMELEN = 64; char my_tcpip_address[NET_NAMELEN]; -#define DEFAULTnet_hostport 26000 +const int DEFAULTnet_hostport = 26000; -#define MAXHOSTNAMELEN 256 +const int MAXHOSTNAMELEN = 256; static int net_acceptsocket = -1; // socket for fielding new connections static int net_controlsocket; @@ -196,7 +193,10 @@ int WINS_Init( void ){ // determine my name & address gethostname( buff, MAXHOSTNAMELEN ); local = gethostbyname( buff ); - myAddr = *(int *)local->h_addr_list[0]; + if(local && local->h_addr_list && local->h_addr_list[0]) + myAddr = *(int *)local->h_addr_list[0]; + else + myAddr = inet_addr("127.0.0.1"); // if the quake hostname isn't set, set it to the machine name // if (Q_strcmp(hostname.string, "UNNAMED") == 0)