[openbeosnetteam] Fix for resolving host names

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


Other related posts: