[openbeosnetteam] Re: Fix for resolving host names

  • From: "Brennan Cleveland" <warriorspot@xxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Mon, 2 Feb 2004 09:05:52 -0600


---- Original Message ----
From: Waldemar.Kornewald@xxxxxx
To: openbeosnetteam@xxxxxxxxxxxxx
Subject: RE: [openbeosnetteam] Re: Fix for resolving host names
Date: Mon, 2 Feb 2004 15:52:56 +0100

>> >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;
>> 
>> If this were true the malloc() call wouldn't compile.  h_errno is
>> actually #defined in netdb.h (i believe) as a pointer variable...
>
>Ouch!!!
>I thought that I fixed this long ago. There was a problem with the
>h_errno stuff. It is #defined to be a function _h_errnop() or so. On
>the other hand it is a pointer that to TLS memory (if I remember
>correctly...).
>To solve the problem you should try to put an
>#undef h_errno
>before every h_errno declaration
>extern int h_errno.
>Otherwise it gets replaced by _h_errnop() and you try to set the
>return value of that function instead of the variable itself. This of
>course fails.
>In compat.c I also made a mistake and put it AFTER the declaration!
>Sorry.
>h_errno is defined in res_query.c. IMHO, it should be moved into
>compat.c. What do you think?
>
>Waldemar
>

Ok, I will check that out tonight... that sounds like a real fix. Why
does that malloc call I added stop the segmentation violations?

Brennan



Other related posts: