mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
refactor: use #ifdef HAVE_SOCKADDR_UN
```bash
init.cpp:526:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
526 | #if HAVE_SOCKADDR_UN
| ^~~~~~~~~~~~~~~~
init.cpp:541:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
541 | #if HAVE_SOCKADDR_UN
| ^~~~~~~~~~~~~~~~
init.cpp:1318:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
1318 | #if HAVE_SOCKADDR_UN
```
```
netbase.cpp:26:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
26 | #if HAVE_SOCKADDR_UN
| ^~~~~~~~~~~~~~~~
netbase.cpp:221:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
221 | #if HAVE_SOCKADDR_UN
| ^~~~~~~~~~~~~~~~
netbase.cpp:496:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
496 | #if HAVE_SOCKADDR_UN
| ^~~~~~~~~~~~~~~~
netbase.cpp:531:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
531 | #if HAVE_SOCKADDR_UN
| ^~~~~~~~~~~~~~~~
netbase.cpp:639:5: error: "HAVE_SOCKADDR_UN" is not defined, evaluates to 0 [-Werror=undef]
639 | #if HAVE_SOCKADDR_UN
```
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
#if HAVE_SOCKADDR_UN
|
||||
#ifdef HAVE_SOCKADDR_UN
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
@@ -218,7 +218,7 @@ CService LookupNumeric(const std::string& name, uint16_t portDefault, DNSLookupF
|
||||
|
||||
bool IsUnixSocketPath(const std::string& name)
|
||||
{
|
||||
#if HAVE_SOCKADDR_UN
|
||||
#ifdef HAVE_SOCKADDR_UN
|
||||
if (name.find(ADDR_PREFIX_UNIX) != 0) return false;
|
||||
|
||||
// Split off "unix:" prefix
|
||||
@@ -527,7 +527,7 @@ std::unique_ptr<Sock> CreateSockOS(int domain, int type, int protocol)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if HAVE_SOCKADDR_UN
|
||||
#ifdef HAVE_SOCKADDR_UN
|
||||
if (domain == AF_UNIX) return sock;
|
||||
#endif
|
||||
|
||||
@@ -638,7 +638,7 @@ std::unique_ptr<Sock> Proxy::Connect() const
|
||||
|
||||
if (!m_is_unix_socket) return ConnectDirectly(proxy, /*manual_connection=*/true);
|
||||
|
||||
#if HAVE_SOCKADDR_UN
|
||||
#ifdef HAVE_SOCKADDR_UN
|
||||
auto sock = CreateSock(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (!sock) {
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Cannot create a socket for connecting to %s\n", m_unix_socket_path);
|
||||
|
||||
Reference in New Issue
Block a user