[I assume that seeing you set Mail-Followup-To, you don't want a cc of this]
On Sat, Oct 02, 1999 at 06:50:40AM +0200, Jakob �stergaard wrote:
> (This is sort of embarassing to ask, but a friend borrowed my SYSV book
> and the glibc info is of little use...)
[..]
> gethostbyname() returns a pointer to a struct hostent so far so good. But
> should I free that structure when I'm done ? Or should the next call to
> gethostbyname() free the previously allocated structure ? (it seems as
> though it doesn't).
gethostbyname() and friends return a pointer to a static structure. And my
glibc info does have it, it's buried down in Sockets -> Internet Namespace
-> Host Addresses -> Host Names:
"You can use `gethostbyname' or `gethostbyaddr' to search the hosts
database for information about a particular host. The information is
returned in a statically-allocated structure; you must copy the
information if you need to save it across calls."
I assume there are thread safe versions kicking around somewhere too, but
I've never used them so don't know how they work (do they alloc the struct
and return it, or just use TLS?).
--
"Water? Never touch the stuff! Fish fuck in it."
-- W. C. Fields
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]