Subject: Re: getaddrinfo() vs. JVM
To: Charles M. Hannum <abuse@spamalicious.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-userlevel
Date: 01/09/2005 16:33:27
"Charles M. Hannum" <abuse@spamalicious.com> writes:

> Actually, I think it is a valid point that with just my change, one user of 
> getaddrinfo() can corrupt the value returned to another user.  The mutex 
> prevents the library from going off into lala land and crashing, but there is 
> still a race in getaddrinfo().

Ah, it is in fact just returning the servent value passed to it, not a
pointer to some other shared structure being searched. "Bummer".

> The problem with Love's patch is that it will cause each thread using 
> getaddrinfo() to open the file/whatever and keep its own state.  This sucks.

Every call to getservbyname() was already doing this - (and thus,
every call to getaddrinfo() - about six times per call), unless there
was a prior call to setservent(1), which doesn't seem to be part of
the formal API of getaddrinfo(). Is that already the case for ordinary
callers of getaddrinfo()?

        - Nathan