Use more sensible value for #ifdef when checking for abstract unix sockets.

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: Icfd849424659c8949f8f3554aa75a8a7ceaf7ac2
This commit is contained in:
Gleb Popov 2021-07-30 17:45:39 +03:00 committed by Tor Lillqvist
parent 0dd30ba28f
commit 950a5c4d1a

View file

@ -53,6 +53,9 @@ constexpr std::chrono::microseconds WebSocketHandler::PingFrequencyMicroS;
std::atomic<bool> SocketPoll::InhibitThreadChecks(false);
std::atomic<bool> 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