Commit a8545958 authored by Max Kellermann's avatar Max Kellermann

event/ServerSocket: runtime error if abstract sockets are unavailable

parent 8fc3c5c6
...@@ -29,10 +29,8 @@ ServerSocketAddGeneric(ServerSocket &server_socket, const char *address, unsigne ...@@ -29,10 +29,8 @@ ServerSocketAddGeneric(ServerSocket &server_socket, const char *address, unsigne
server_socket.AddPort(port); server_socket.AddPort(port);
} else if (address[0] == '/' || address[0] == '~') { } else if (address[0] == '/' || address[0] == '~') {
server_socket.AddPath(ParsePath(address)); server_socket.AddPath(ParsePath(address));
#ifdef __linux__
} else if (address[0] == '@') { } else if (address[0] == '@') {
server_socket.AddAbstract(address); server_socket.AddAbstract(address);
#endif
} else { } else {
server_socket.AddHost(address, port); server_socket.AddHost(address, port);
} }
......
...@@ -397,12 +397,14 @@ ServerSocket::AddPath(AllocatedPath &&path) ...@@ -397,12 +397,14 @@ ServerSocket::AddPath(AllocatedPath &&path)
} }
#ifdef __linux__
void void
ServerSocket::AddAbstract(const char *name) ServerSocket::AddAbstract(const char *name)
{ {
#if !defined(HAVE_UN) #if !defined(__linux__)
(void)name;
throw std::runtime_error("Abstract sockets are only available on Linux");
#elif !defined(HAVE_UN)
(void)name; (void)name;
throw std::runtime_error("Local socket support is disabled"); throw std::runtime_error("Local socket support is disabled");
...@@ -416,5 +418,3 @@ ServerSocket::AddAbstract(const char *name) ...@@ -416,5 +418,3 @@ ServerSocket::AddAbstract(const char *name)
AddAddress(std::move(address)); AddAddress(std::move(address));
#endif #endif
} }
#endif
...@@ -99,7 +99,6 @@ public: ...@@ -99,7 +99,6 @@ public:
*/ */
void AddPath(AllocatedPath &&path); void AddPath(AllocatedPath &&path);
#ifdef __linux__
/** /**
* Add a listener on an abstract local socket (Linux specific). * Add a listener on an abstract local socket (Linux specific).
* *
...@@ -109,7 +108,6 @@ public: ...@@ -109,7 +108,6 @@ public:
* instead of a null byte * instead of a null byte
*/ */
void AddAbstract(const char *name); void AddAbstract(const char *name);
#endif
/** /**
* Add a socket descriptor that is accepting connections. After this * Add a socket descriptor that is accepting connections. After this
......
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