cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and sock_cloexec

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 25 Apr 2011 23:41:13 +0200 (CEST)

On Mon, 25 Apr 2011, Ben Noordhuis wrote:

> You're going to say "Well! Don't do that then!" and you'd be right. But this
> is a kind of bug that easily slips through yet is very pernicious. To name
> something: libcurl's connection cache. I've never tried it but I'm pretty
> sure that forking while it's active is going to produce some rather
> interesting and unexpected results.
>
> It's a good UNIX tradition to always open sockets and files with F_CLOEXEC -
> or it used to be, anyway. But tradition or not, it's still a good idea. :-)

I guess the question could perhaps also be put the other way: could there
actually and realistically be any harm in making the sockets use F_CLOEXEC
unconditionally?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-25