[openbeosnetteam] Re: Fix for resolving host names

  • From: "David McPaul" <dmcpaul@xxxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Mon, 02 Feb 2004 19:18:38 +1100 EST

I would say no.

Where is h_errno implemented?

It is defined as external to gethostnamadr.c and it is defined as 

extern int h_errno;

not 
extern int * h_errno;

Cheers
David

> Team,
> 
> I fixed the issue with segmentation violations when resolving 
> hostnames 
> to IP addresses using /etc/hosts.  However, I don't really know if it 
> is a proper fix.  As you know, only the first line of /etc/hosts 
> would 
> work.  If the host name was on any line after 1, or was not in 
> /etc/hosts, or if /etc/hosts did not exist, you would get a 
> segmentation violation.   After much hunting around and dead ends, I 
> found that adding the following line to the gethostbyname(const char 
> *name) function in gethostnamadr.c as the first executable line of 
> code 
> seems to fix the issue:
> 
> h_errno = (int *)malloc(sizeof(int));
> 
> If you agree this is an actual fix, and not a workaround for a larger 
> problem that I'm not seeing, go ahead and submit it.
> 
> Thanks,
> 
> Brennan
> 
> 
Cheers
David


--
The National Short-Sleeved Shirt Association says:
        Support your right to bare arms!

Other related posts: