diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-05-03 13:43:35 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-05-03 13:43:35 +0000 |
commit | b84b71f5241e18ee3e6bde5bdb9d257c71b56d5f (patch) | |
tree | e61aa7648b79b7413dd0437f152472693fd15f64 /lib/connect.c | |
parent | 3d29bda9f836d21b35110d6a005d56b6931bee6a (diff) | |
download | curl-b84b71f5241e18ee3e6bde5bdb9d257c71b56d5f.tar.gz |
- Jean-Francois Bertrand reported a libcurl crash with CURLOPT_TCP_NODELAY
since libcurl used getprotobyname() and that isn't thread-safe. We now
switched to use IPPROTO_TCP unconditionally, but perhaps the proper fix is
to detect the thread-safe version of the function and use that.
http://curl.haxx.se/mail/lib-2008-05/0011.html
Diffstat (limited to 'lib/connect.c')
-rw-r--r-- | lib/connect.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c index dcccfe4d2..33e4e0777 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -685,7 +685,14 @@ static void tcpnodelay(struct connectdata *conn, socklen_t onoff = (socklen_t) data->set.tcp_nodelay; int proto = IPPROTO_TCP; -#ifdef HAVE_GETPROTOBYNAME +#if 0 + /* The use of getprotobyname() is disabled since it isn't thread-safe on + numerous systems. On these getprotobyname_r() should be used instead, but + that exists in at least one 4 arg version and one 5 arg version, and + since the proto number rarely changes anyway we now just use the hard + coded number. The "proper" fix would need a configure check for the + correct function much in the same style the gethostbyname_r versions are + detected. */ struct protoent *pe = getprotobyname("tcp"); if(pe) proto = pe->p_proto; |