diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-09-02 15:34:12 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-09-02 15:34:12 +0200 |
commit | 8b7ac4c2a9c3ede95d6f5f9717a1939a23788964 (patch) | |
tree | 9afa85cda119a35f2dcd18eb7ff77e92cb8bd78a /src/tcp_address.cpp | |
parent | 2910a728dc777068e6ae7f67041da185b0865171 (diff) |
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>
Diffstat (limited to 'src/tcp_address.cpp')
-rw-r--r-- | src/tcp_address.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp index 999c015..b6370fa 100644 --- a/src/tcp_address.cpp +++ b/src/tcp_address.cpp @@ -25,6 +25,7 @@ #include "platform.hpp" #include "stdint.hpp" #include "err.hpp" +#include "ip.hpp" #ifdef ZMQ_HAVE_WINDOWS #include "windows.hpp" @@ -56,7 +57,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_) (void) ipv4only_; // Create a socket. - int fd = socket (AF_INET, SOCK_DGRAM, 0); + int fd = open_socket (AF_INET, SOCK_DGRAM, 0); zmq_assert (fd != -1); // Retrieve number of interfaces. @@ -121,7 +122,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_) (void) ipv4only_; // Create a socket. - int sd = socket (AF_INET, SOCK_DGRAM, 0); + int sd = open_socket (AF_INET, SOCK_DGRAM, 0); zmq_assert (sd != -1); struct ifreq ifr; |