mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-17 08:34:00 +00:00
Merge pull request #382 from hurtonm/master
Fix open_socket to return -1 (INVALID_SOCKET on Windows) on error
This commit is contained in:
commit
21eb8c8fa5
@ -46,8 +46,13 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fd_t s = socket (domain_, type_, protocol_);
|
fd_t s = socket (domain_, type_, protocol_);
|
||||||
if (s == retired_fd)
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
return retired_fd;
|
if (s == INVALID_SOCKET)
|
||||||
|
return INVALID_SOCKET
|
||||||
|
#else
|
||||||
|
if (s == -1)
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// If there's no SOCK_CLOEXEC, let's try the second best option. Note that
|
// If there's no SOCK_CLOEXEC, let's try the second best option. Note that
|
||||||
// race condition can cause socket not to be closed (if fork happens
|
// race condition can cause socket not to be closed (if fork happens
|
||||||
|
Loading…
x
Reference in New Issue
Block a user