Commit ebf607ee authored by Max Kellermann's avatar Max Kellermann

net/SocketDescriptor: fix SOCK_NONBLOCK flag in CreateSocketPairNonBlock()

parent e092eadd
...@@ -170,7 +170,7 @@ SocketDescriptor::CreateNonBlock(int domain, int type, int protocol) noexcept ...@@ -170,7 +170,7 @@ SocketDescriptor::CreateNonBlock(int domain, int type, int protocol) noexcept
bool bool
SocketDescriptor::CreateSocketPair(int domain, int type, int protocol, SocketDescriptor::CreateSocketPair(int domain, int type, int protocol,
SocketDescriptor &a, SocketDescriptor &a,
SocketDescriptor &b) noexcept SocketDescriptor &b) noexcept
{ {
#ifdef SOCK_CLOEXEC #ifdef SOCK_CLOEXEC
...@@ -189,17 +189,17 @@ SocketDescriptor::CreateSocketPair(int domain, int type, int protocol, ...@@ -189,17 +189,17 @@ SocketDescriptor::CreateSocketPair(int domain, int type, int protocol,
bool bool
SocketDescriptor::CreateSocketPairNonBlock(int domain, int type, int protocol, SocketDescriptor::CreateSocketPairNonBlock(int domain, int type, int protocol,
SocketDescriptor &a, SocketDescriptor &a,
SocketDescriptor &b) noexcept SocketDescriptor &b) noexcept
{ {
#ifdef SOCK_CLOEXEC #ifdef SOCK_NONBLOCK
/* implemented since Linux 2.6.27 */ type |= SOCK_NONBLOCK;
type |= SOCK_CLOEXEC;
#endif #endif
if (!CreateSocketPair(domain, type, protocol, a, b)) if (!CreateSocketPair(domain, type, protocol, a, b))
return false; return false;
#ifndef __linux__ #ifndef SOCK_NONBLOCK
a.SetNonBlocking(); a.SetNonBlocking();
b.SetNonBlocking(); b.SetNonBlocking();
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment