0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-28 16:15:23 +08:00

Merge pull request #4104 from gummif/patch-1

Problem: Build error on MSVC with C++20 in ip.cpp
This commit is contained in:
Luca Boccassi 2020-12-18 12:59:09 +00:00 committed by GitHub
commit 76849aa3d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -559,6 +559,10 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
#ifdef ZMQ_HAVE_IPC #ifdef ZMQ_HAVE_IPC
ipc_address_t address; ipc_address_t address;
std::string dirname, filename; std::string dirname, filename;
sockaddr_un lcladdr;
socklen_t lcladdr_len = sizeof lcladdr;
int rc = 0;
int saved_errno = 0;
// Create a listening socket. // Create a listening socket.
const SOCKET listener = open_socket (AF_UNIX, SOCK_STREAM, 0); const SOCKET listener = open_socket (AF_UNIX, SOCK_STREAM, 0);
@ -570,7 +574,7 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
create_ipc_wildcard_address (dirname, filename); create_ipc_wildcard_address (dirname, filename);
// Initialise the address structure. // Initialise the address structure.
int rc = address.resolve (filename.c_str ()); rc = address.resolve (filename.c_str ());
if (rc != 0) { if (rc != 0) {
goto error_closelistener; goto error_closelistener;
} }
@ -590,9 +594,6 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
goto error_closelistener; goto error_closelistener;
} }
sockaddr_un lcladdr;
socklen_t lcladdr_len = sizeof lcladdr;
rc = getsockname (listener, reinterpret_cast<struct sockaddr *> (&lcladdr), rc = getsockname (listener, reinterpret_cast<struct sockaddr *> (&lcladdr),
&lcladdr_len); &lcladdr_len);
wsa_assert (rc != -1); wsa_assert (rc != -1);
@ -621,7 +622,7 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
return 0; return 0;
error_closeclient: error_closeclient:
int saved_errno = errno; saved_errno = errno;
rc = closesocket (*w_); rc = closesocket (*w_);
wsa_assert (rc == 0); wsa_assert (rc == 0);
errno = saved_errno; errno = saved_errno;