cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: gethostbyname_r

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 15 Feb 2003 18:53:53 +0100 (CET)

On Sat, 15 Feb 2003, kilaru wrote:

> My application is giving seg fault when I give ill-formatted IP address.
> Ex: "192.168.128.45:" -- ':' is also given to curl library along with the
> valid IP address.
>
> I saw in debugger that gethostbyname_r() was returning 0 for that IP
> address where it should have returned some error.

Are you talking about libcurl here? If so, then you can stop. libcurl (when
built IPv6-disabled) does not use gethostbyname_r() or any similar function
if the given input is IP-only.

> I checked in the archives and found couple of mails abt some problem with
> gethostbyname_r() in RedHat 8.

gethostbyname_r() is one helluva function. It has no docs, works differently
everywhere and Redhat ships a broken implementation in 8.0.

> I also found that somebody has posted some patch for that problem with
> gethostbyname_r().
>
> Where do I get that patch?

The problem was how libcurl uses gethostbyname_r() on Linux, and the latest
libcurl uses it the patched way. Just read the sources. lib/hostip.c is the
file you want to study.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-02-15