summaryrefslogtreecommitdiffstats
path: root/chromium/patches/021-musl-no-res-ninit.patch
blob: d74f6cd88c92b99fd8d83a8abf04fabb3d5f9702 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 {