[ut2003io] Re: Single Player Seg Fault - Fixed! SOLVED !!

Bernd Dau Bernd at Daucity.de
Thu Oct 10 19:04:34 EDT 2002


OK:
$ testhostname
gethostbyname() returned NULL!
--- oh my god!

my /etc/hosts
cat /etc/hosts
__________________
127.0.0.1               localhost.localdomain localhost
_______________


After putting my IP in it it works. 
I knew my own dns isn't working :)

For clearness and and other stucked users:
ifconfig eth0 shows your very own ip:
For me:
inet Adresse:192.168.0.246

put it into the /etc/hosts
so it looks like this:
_____________________

__________________
127.0.0.1               localhost.localdomain localhost
192.168.0.246 		bed.homelan.test bed
_______________

Now everything works fine, I just smashed the first bad guy!

Thank You very much Ryan!

cu Bernd 

Am Don, 2002-10-10 um 22.24 schrieb Ryan C. Gordon:
> > This is the output from the coredump.
> > Maybe someone can track down the problem?
> 
> Not promising anything meaningful here, but please compile the attached 
> program:
> 
> gcc -o testhostname testhostname.c
> 
> Run it, and tell me what it outputs.
> 
> --ryan.
> 
> 
> 
> ----
> 

> #include <stdio.h>
> #include <unistd.h>
> #include <netdb.h>
> 
> int main(void)
> {
> 	static unsigned long LocalIP = 0;
> 	struct hostent *Hostinfo;
> 	char Hostname[256];
> 
>   	gethostname( Hostname, sizeof(Hostname) );
>    	Hostinfo = gethostbyname( Hostname );
>     if (Hostinfo == NULL)
>         printf("gethostbyname() returned NULL!\n");
>     else
>     {
>  	    LocalIP = *(unsigned long*)Hostinfo->h_addr_list[0];
>         printf("local IP is %lu\n", LocalIP);
>         printf("(That's %d.%d.%d.%d) ...\n",
>                 (LocalIP & 0xFF),
>                 ((LocalIP >> 8) & 0xFF),
>                 ((LocalIP >> 16) & 0xFF),
>                 ((LocalIP >> 24) & 0xFF));
>     }
> 
>     return(0);
> }
> 





More information about the ut2003 mailing list