diff options
author | Max Kellermann <max@musicpd.org> | 2019-03-20 13:09:16 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-03-20 13:09:16 +0100 |
commit | a8545958868e7f2805729cb41d49c2eb842826aa (patch) | |
tree | b8caffcbff540f1d5a070948073b92c19a3499be /src | |
parent | 8fc3c5c6123f6d36219e31ad5ef011a8179ed2cd (diff) |
event/ServerSocket: runtime error if abstract sockets are unavailable
Diffstat (limited to 'src')
-rw-r--r-- | src/config/Net.cxx | 2 | ||||
-rw-r--r-- | src/event/ServerSocket.cxx | 10 | ||||
-rw-r--r-- | src/event/ServerSocket.hxx | 2 |
3 files changed, 5 insertions, 9 deletions
diff --git a/src/config/Net.cxx b/src/config/Net.cxx index afba81f9d..fce05aa71 100644 --- a/src/config/Net.cxx +++ b/src/config/Net.cxx @@ -29,10 +29,8 @@ ServerSocketAddGeneric(ServerSocket &server_socket, const char *address, unsigne server_socket.AddPort(port); } else if (address[0] == '/' || address[0] == '~') { server_socket.AddPath(ParsePath(address)); -#ifdef __linux__ } else if (address[0] == '@') { server_socket.AddAbstract(address); -#endif } else { server_socket.AddHost(address, port); } diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 4ff5481e7..728f5fd2e 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -397,12 +397,14 @@ ServerSocket::AddPath(AllocatedPath &&path) } -#ifdef __linux__ - void 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; throw std::runtime_error("Local socket support is disabled"); @@ -416,5 +418,3 @@ ServerSocket::AddAbstract(const char *name) AddAddress(std::move(address)); #endif } - -#endif diff --git a/src/event/ServerSocket.hxx b/src/event/ServerSocket.hxx index 91c129458..ec027b295 100644 --- a/src/event/ServerSocket.hxx +++ b/src/event/ServerSocket.hxx @@ -99,7 +99,6 @@ public: */ void AddPath(AllocatedPath &&path); -#ifdef __linux__ /** * Add a listener on an abstract local socket (Linux specific). * @@ -109,7 +108,6 @@ public: * instead of a null byte */ void AddAbstract(const char *name); -#endif /** * Add a socket descriptor that is accepting connections. After this |