void-packages/srcpkgs/qt6-pdf/patches/0117-chromium-musl-resolver.patch
2023-12-12 13:46:18 +07:00

60 lines
2.4 KiB
Diff

diff --git a/src/3rdparty/chromium/net/dns/dns_reloader.cc b/src/3rdparty/chromium/net/dns/dns_reloader.cc
index 363eb14dc..3a86c12ee 100644
--- a/src/3rdparty/chromium/net/dns/dns_reloader.cc
+++ b/src/3rdparty/chromium/net/dns/dns_reloader.cc
@@ -8,7 +8,7 @@
// If we're not on a POSIX system, it's not even safe to try to include resolv.h
// - there's not guarantee it exists at all. :(
-#if BUILDFLAG(IS_POSIX)
+#if defined(__GLIBC__)
#include <resolv.h>
diff --git a/src/3rdparty/chromium/net/dns/host_resolver_system_task.cc b/src/3rdparty/chromium/net/dns/host_resolver_system_task.cc
index d8142e8da..f2461b877 100644
--- a/src/3rdparty/chromium/net/dns/host_resolver_system_task.cc
+++ b/src/3rdparty/chromium/net/dns/host_resolver_system_task.cc
@@ -351,8 +351,9 @@ void HostResolverSystemTask::OnLookupComplete(const uint32_t attempt_number,
}
void EnsureSystemHostResolverCallReady() {
+#if defined(__GLIBC__)
EnsureDnsReloaderInit();
-#if BUILDFLAG(IS_WIN)
+#elif BUILDFLAG(IS_WIN)
EnsureWinsockInit();
#endif
}
@@ -434,7 +435,9 @@ int SystemHostResolverCall(const std::string& host,
// current process during that time.
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::WILL_BLOCK);
+#if defined(__GLIBC__)
DnsReloaderMaybeReload();
+#endif
auto [ai, err, os_error] = AddressInfo::Get(host, hints, nullptr, network);
bool should_retry = false;
diff --git a/src/3rdparty/chromium/net/dns/public/scoped_res_state.cc b/src/3rdparty/chromium/net/dns/public/scoped_res_state.cc
index 2743697bf..36dc8adbf 100644
--- a/src/3rdparty/chromium/net/dns/public/scoped_res_state.cc
+++ b/src/3rdparty/chromium/net/dns/public/scoped_res_state.cc
@@ -13,7 +13,7 @@
namespace net {
ScopedResState::ScopedResState() {
-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
+#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_LINUX) && !defined(__GLIBC__))
// Note: res_ninit in glibc always returns 0 and sets RES_INIT.
// res_init behaves the same way.
memset(&_res, 0, sizeof(_res));
@@ -25,7 +25,7 @@ ScopedResState::ScopedResState() {
}
ScopedResState::~ScopedResState() {
-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
+#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) && !(BUILDFLAG(IS_LINUX) && !defined(__GLIBC__))
// Prefer res_ndestroy where available.
#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)