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