All file descriptors should be opened with the CLOEXEC flag

Description

TCP and Unix sockets are opened with the CLOEXEC flag through zmq::open_socket in ip.cpp.
However some other file descriptors are not opened with the close-on-exec flag and so they will not be closed in case of a fork+exec. This may be a problem for processes which fork themselves, for instance a frontend process which forks worker processes to handle requests.
Examples of such file descriptors are fds created by eventfd in signaler.cpp, fds created by epoll_create in epoll.cpp, and fds created for /dev/poll in devpoll.cpp.

A patch is attached.

Environment

Linux

Attachments

1
  • 01 Aug 2012, 08:12 AM

Activity

Show:

Martin Hurton October 25, 2012 at 5:23 PM

Rene, could you please create a pull-request so that we can merge your patch? Thanks!

Assignee

Reporter

Components

Affects versions

Priority

Created August 1, 2012 at 8:12 AM
Updated October 25, 2012 at 5:23 PM