diff options
Diffstat (limited to 'Userland/Libraries/LibCore/LocalServer.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/LocalServer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index 1d3d6099ca..1acb063cf1 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -141,12 +141,22 @@ RefPtr<LocalSocket> LocalServer::accept() VERIFY(m_listening); sockaddr_un un; socklen_t un_size = sizeof(un); +#ifndef AK_OS_MACOS + int accepted_fd = ::accept4(m_fd, (sockaddr*)&un, &un_size, SOCK_NONBLOCK | SOCK_CLOEXEC); +#else int accepted_fd = ::accept(m_fd, (sockaddr*)&un, &un_size); +#endif if (accepted_fd < 0) { perror("accept"); return nullptr; } +#ifdef AK_OS_MACOS + int option = 1; + ioctl(m_fd, FIONBIO, &option); + (void)fcntl(accepted_fd, F_SETFD, FD_CLOEXEC); +#endif + return LocalSocket::construct(accepted_fd); } |