From 6996ef6f1a0a50a754608df9444e425d0900b143 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sat, 29 Aug 2009 09:41:50 +0200 Subject: improved error handling --- src/tcp_listener.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/tcp_listener.cpp') diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index 937618d..de62879 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -55,11 +55,10 @@ zmq::tcp_listener_t::~tcp_listener_t () int zmq::tcp_listener_t::set_address (const char *addr_) { // Convert the interface into sockaddr_in structure. - return resolve_ip_interface (&addr, addr_); -} + int rc = resolve_ip_interface (&addr, addr_); + if (rc != 0) + return rc; -int zmq::tcp_listener_t::open () -{ // Create a listening socket. s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == -1) @@ -67,7 +66,7 @@ int zmq::tcp_listener_t::open () // Allow reusing of the address. int flag = 1; - int rc = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof (int)); + rc = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof (int)); errno_assert (rc == 0); // Set the non-blocking flag. -- cgit v1.2.3