mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-20 14:24:38 +01:00
Incorrect errno reported from tcp_listener_t::set_address
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
parent
32ded2b457
commit
f5015f4c93
@ -201,14 +201,20 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_,
|
||||
// Bind the socket to the network interface and port.
|
||||
rc = bind (s, (struct sockaddr*) &addr, addr_len);
|
||||
if (rc != 0) {
|
||||
close ();
|
||||
int err = errno;
|
||||
if (close () != 0)
|
||||
return -1;
|
||||
errno = err;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Listen for incomming connections.
|
||||
rc = listen (s, backlog_);
|
||||
if (rc != 0) {
|
||||
close ();
|
||||
int err = errno;
|
||||
if (close () != 0)
|
||||
return -1;
|
||||
errno = err;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -241,7 +247,10 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_,
|
||||
// Bind the socket to the file path.
|
||||
rc = bind (s, (struct sockaddr*) &addr, addr_len);
|
||||
if (rc != 0) {
|
||||
close ();
|
||||
int err = errno;
|
||||
if (close () != 0)
|
||||
return -1;
|
||||
errno = err;
|
||||
return -1;
|
||||
}
|
||||
has_file = true;
|
||||
@ -249,7 +258,10 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_,
|
||||
// Listen for incomming connections.
|
||||
rc = listen (s, backlog_);
|
||||
if (rc != 0) {
|
||||
close ();
|
||||
int err = errno;
|
||||
if (close () != 0)
|
||||
return -1;
|
||||
errno = err;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user