Close file descriptors on exec (issue 218)

When exec is executed to start a different process image old
0MQ file descriptors could stay open, thus blocking TCP ports
and alike. This patch should solve the problem.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik
2011-09-02 15:34:12 +02:00
parent 2910a728dc
commit 8b7ac4c2a9
8 changed files with 37 additions and 9 deletions

View File

@@ -32,6 +32,7 @@
#include "session.hpp"
#include "config.hpp"
#include "err.hpp"
#include "ip.hpp"
#include <unistd.h>
#include <sys/socket.h>
@@ -108,7 +109,7 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
return -1;
// Create a listening socket.
s = ::socket (AF_UNIX, SOCK_STREAM, 0);
s = open_socket (AF_UNIX, SOCK_STREAM, 0);
if (s == -1)
return -1;