preload-hacks: Some patches to make it work.
[termux-packages] / packages / c-ares / disable-ares-android.patch
CommitLineData
ea09f74e
FF
1diff -u -r ../c-ares-1.13.1-20180102/ares_android.c ./ares_android.c
2--- ../c-ares-1.13.1-20180102/ares_android.c 2017-12-22 04:44:06.000000000 +0100
3+++ ./ares_android.c 2018-01-03 01:56:59.552603162 +0100
4@@ -12,7 +12,7 @@
5 * this software for any purpose. It is provided "as is"
6 * without express or implied warranty.
7 */
8-#if defined(ANDROID) || defined(__ANDROID__)
9+#if defined(__DISABLED_IN_TERMUX__)
10
11 #include <jni.h>
12
13diff -u -r ../c-ares-1.13.1-20180102/ares_init.c ./ares_init.c
14--- ../c-ares-1.13.1-20180102/ares_init.c 2017-12-21 04:44:05.000000000 +0100
15+++ ./ares_init.c 2018-01-03 01:57:59.915887972 +0100
16@@ -44,7 +44,6 @@
17
18 #if defined(ANDROID) || defined(__ANDROID__)
19 #include <sys/system_properties.h>
20-#include "ares_android.h"
21 /* From the Bionic sources */
22 #define DNS_PROP_NAME_PREFIX "net.dns"
23 #define MAX_DNS_PROPERTIES 8
24@@ -1618,29 +1617,6 @@
25 char **dns_servers;
26 size_t num_servers;
27
28- /* Use the Android connectivity manager to get a list
29- * of DNS servers. As of Android 8 (Oreo) net.dns#
30- * system properties are no longer available. Google claims this
31- * improves privacy. Apps now need the ACCESS_NETWORK_STATE
32- * permission and must use the ConnectivityManager which
33- * is Java only. */
34- dns_servers = ares_get_android_server_list(MAX_DNS_PROPERTIES, &num_servers);
35- if (dns_servers != NULL)
36- {
37- for (i = 0; i < num_servers; i++)
38- {
39- status = config_nameserver(&servers, &nservers, dns_servers[i]);
40- if (status != ARES_SUCCESS)
41- break;
42- status = ARES_EOF;
43- }
44- for (i = 0; i < num_servers; i++)
45- {
46- ares_free(dns_servers[i]);
47- }
48- ares_free(dns_servers);
49- }
50-
51 # ifdef HAVE___SYSTEM_PROPERTY_GET
52 /* Old way using the system property still in place as
53 * a fallback. Older android versions can still use this.
54diff -u -r ../c-ares-1.13.1-20180102/ares_library_init.c ./ares_library_init.c
55--- ../c-ares-1.13.1-20180102/ares_library_init.c 2017-09-29 04:44:07.000000000 +0200
56+++ ./ares_library_init.c 2018-01-03 01:56:59.552603162 +0100
57@@ -30,10 +30,6 @@
58 fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL;
59 #endif
60
61-#if defined(ANDROID) || defined(__ANDROID__)
62-#include "ares_android.h"
63-#endif
64-
65 /* library-private global vars with source visibility restricted to this file */
66
67 static unsigned int ares_initialized;
68@@ -164,10 +160,6 @@
69 if (ares_init_flags & ARES_LIB_INIT_WIN32)
70 ares_win32_cleanup();
71
72-#if defined(ANDROID) || defined(__ANDROID__)
73- ares_library_cleanup_android();
74-#endif
75-
76 ares_init_flags = ARES_LIB_INIT_NONE;
77 ares_malloc = malloc;
78 ares_realloc = realloc;