summaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qtwebengine/0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-qt/qt5/qtwebengine/0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch')
-rw-r--r--recipes-qt/qt5/qtwebengine/0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtwebengine/0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch b/recipes-qt/qt5/qtwebengine/0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch
new file mode 100644
index 00000000..1825ed7b
--- /dev/null
+++ b/recipes-qt/qt5/qtwebengine/0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch
@@ -0,0 +1,81 @@
1From df3fd62f7f0c51c11e7f715c2523418c31eb6b0f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 7 Jul 2017 15:27:50 -0700
4Subject: [PATCH 10/12] Define res_ninit and res_nclose for non-glibc platforms
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 net/dns/dns_config_service_posix.cc | 4 ++++
9 net/dns/dns_reloader.cc | 4 ++++
10 net/dns/resolv_compat.h | 29 +++++++++++++++++++++++++++++
11 3 files changed, 37 insertions(+)
12 create mode 100644 net/dns/resolv_compat.h
13
14diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
15index ba8a36913..e9b40d07f 100644
16--- a/net/dns/dns_config_service_posix.cc
17+++ b/net/dns/dns_config_service_posix.cc
18@@ -25,6 +25,10 @@
19 #include "net/dns/notify_watcher_mac.h"
20 #include "net/dns/serial_worker.h"
21
22+#if defined(OS_LINUX) && !defined(__GLIBC__)
23+#include "net/dns/resolv_compat.h"
24+#endif
25+
26 #if defined(OS_MACOSX) && !defined(OS_IOS)
27 #include "net/dns/dns_config_watcher_mac.h"
28 #endif
29diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc
30index 74534e6b1..2780a776e 100644
31--- a/net/dns/dns_reloader.cc
32+++ b/net/dns/dns_reloader.cc
33@@ -9,6 +9,10 @@
34
35 #include <resolv.h>
36
37+#if defined(OS_LINUX) && !defined(__GLIBC__)
38+#include "net/dns/resolv_compat.h"
39+#endif
40+
41 #include "base/lazy_instance.h"
42 #include "base/logging.h"
43 #include "base/macros.h"
44diff --git a/net/dns/resolv_compat.h b/net/dns/resolv_compat.h
45new file mode 100644
46index 000000000..4f0e852a1
47--- /dev/null
48+++ b/net/dns/resolv_compat.h
49@@ -0,0 +1,29 @@
50+#if !defined(__GLIBC__)
51+/***************************************************************************
52+ * resolv_compat.h
53+ *
54+ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc
55+ * Note: res_init() is actually deprecated according to
56+ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html
57+ **************************************************************************/
58+#include <string.h>
59+
60+static inline int res_ninit(res_state statp)
61+{
62+ int rc = res_init();
63+ if (statp != &_res) {
64+ memcpy(statp, &_res, sizeof(*statp));
65+ }
66+ return rc;
67+}
68+
69+static inline int res_nclose(res_state statp)
70+{
71+ if (!statp)
72+ return -1;
73+ if (statp != &_res) {
74+ memset(statp, 0, sizeof(*statp));
75+ }
76+ return 0;
77+}
78+#endif
79--
802.13.2
81