ayaports/backports/electron/no-res-ninit-nclose.patch

32 lines
1 KiB
Diff

similar to dns-resolver.patch, musl doesn't have res_ninit and so on
--
--- a/net/dns/public/scoped_res_state.cc
+++ b/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) || defined(_GNU_SOURCE)
// Note: res_ninit in glibc always returns 0 and sets RES_INIT.
// res_init behaves the same way.
memset(&_res, 0, sizeof(_res));
@@ -25,16 +25,8 @@
}
ScopedResState::~ScopedResState() {
-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
-
- // Prefer res_ndestroy where available.
-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
- res_ndestroy(&res_);
-#else
- res_nclose(&res_);
-#endif // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
-
-#endif // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
+ // musl res_init() doesn't actually do anything
+ // no destruction is necessary as no memory has been allocated
}
bool ScopedResState::IsValid() const {