diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-21 11:27:15 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-21 11:27:15 +0200 |
commit | ebf607eef8b1592a2c9eb05d82934c5b5d4dc337 (patch) | |
tree | 2042a5f25caddb78d817691407dfecd8db4fd0f6 /src/net | |
parent | e092eadd8d7b9a97e951802ea69f232cdd153078 (diff) |
net/SocketDescriptor: fix SOCK_NONBLOCK flag in CreateSocketPairNonBlock()
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/SocketDescriptor.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/net/SocketDescriptor.cxx b/src/net/SocketDescriptor.cxx index f7226ce65..46c6a2240 100644 --- a/src/net/SocketDescriptor.cxx +++ b/src/net/SocketDescriptor.cxx @@ -170,7 +170,7 @@ SocketDescriptor::CreateNonBlock(int domain, int type, int protocol) noexcept bool SocketDescriptor::CreateSocketPair(int domain, int type, int protocol, - SocketDescriptor &a, + SocketDescriptor &a, SocketDescriptor &b) noexcept { #ifdef SOCK_CLOEXEC @@ -189,17 +189,17 @@ SocketDescriptor::CreateSocketPair(int domain, int type, int protocol, bool SocketDescriptor::CreateSocketPairNonBlock(int domain, int type, int protocol, - SocketDescriptor &a, + SocketDescriptor &a, SocketDescriptor &b) noexcept { -#ifdef SOCK_CLOEXEC - /* implemented since Linux 2.6.27 */ - type |= SOCK_CLOEXEC; +#ifdef SOCK_NONBLOCK + type |= SOCK_NONBLOCK; #endif + if (!CreateSocketPair(domain, type, protocol, a, b)) return false; -#ifndef __linux__ +#ifndef SOCK_NONBLOCK a.SetNonBlocking(); b.SetNonBlocking(); #endif |