From 950a5c4d1af3893c223e971be7177f930adf5376 Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Fri, 30 Jul 2021 17:45:39 +0300 Subject: [PATCH] Use more sensible value for #ifdef when checking for abstract unix sockets. Signed-off-by: Gleb Popov <6yearold@gmail.com> Change-Id: Icfd849424659c8949f8f3554aa75a8a7ceaf7ac2 --- net/Socket.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/Socket.cpp b/net/Socket.cpp index 5e9f3abe1..54e13d00f 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -53,6 +53,9 @@ constexpr std::chrono::microseconds WebSocketHandler::PingFrequencyMicroS; std::atomic SocketPoll::InhibitThreadChecks(false); std::atomic Socket::InhibitThreadChecks(false); +#ifdef __linux__ +#define HAVE_ABSTRACT_UNIX_SOCKETS +#endif #define SOCKET_ABSTRACT_UNIX_NAME "0loolwsd-" int Socket::createSocket(Socket::Type type) @@ -518,7 +521,7 @@ void SocketPoll::insertNewUnixSocket( struct sockaddr_un addrunix; std::memset(&addrunix, 0, sizeof(addrunix)); addrunix.sun_family = AF_UNIX; -#ifdef __linux__ +#ifdef HAVE_ABSTRACT_UNIX_SOCKETS addrunix.sun_path[0] = '\0'; // abstract name #else addrunix.sun_path[0] = '0'; @@ -959,7 +962,7 @@ std::string LocalServerSocket::bind() std::memset(&addrunix, 0, sizeof(addrunix)); addrunix.sun_family = AF_UNIX; std::memcpy(addrunix.sun_path, socketAbstractUnixName.c_str(), socketAbstractUnixName.length()); -#ifdef __linux__ +#ifdef HAVE_ABSTRACT_UNIX_SOCKETS addrunix.sun_path[0] = '\0'; // abstract name #endif