cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and sock_cloexec

From: Ben Noordhuis <info_at_bnoordhuis.nl>
Date: Tue, 26 Apr 2011 17:22:05 +0200

On Tue, Apr 26, 2011 at 16:00, Paul Albrecht <albrecht_at_glccom.com> wrote:
> Sockets are created with the socket system call, not the open system
> call, so we're talking about setting the SOCK_CLOEXEC flag as the
> default whenever a socket is created using the socket system call. This
> will have to be configurable on linux because the flag isn't supported
> before 2.6.27. Not sure about the availability of the flag on other
> unices.

The traditional approach is to set FD_CLOEXEC with fcntl(sockfd,
F_SETFD, FD_CLOEXEC) but that doesn't seem to work any more with
2.6.32. Maybe just as well, the time between socket() and fcntl() is a
race window.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-26