aboutsummaryrefslogtreecommitdiff
path: root/libc/dns/net/gethostsfile.c
diff options
context:
space:
mode:
authorAli B <abittin@gmail.com>2020-12-07 10:57:01 +0100
committerGerrit Code Review <gerrit@box1>2020-12-07 10:57:01 +0100
commit202efb89dab30af5311f7f6b5717ad6006e90364 (patch)
treefeab266c11c0d0bce876a8975393d21884c0da04 /libc/dns/net/gethostsfile.c
parent408227d12df4dd2f3235d43a3dd0c271443d975a (diff)
parenta88e6adaca4b6d385aa98ca5ea819264d2fd4a95 (diff)
Merge "Make hosts cache respect toggle-able adblock file" into r11.0r11.0
Diffstat (limited to 'libc/dns/net/gethostsfile.c')
-rw-r--r--libc/dns/net/gethostsfile.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libc/dns/net/gethostsfile.c b/libc/dns/net/gethostsfile.c
new file mode 100644
index 000000000..ee5618ba3
--- /dev/null
+++ b/libc/dns/net/gethostsfile.c
@@ -0,0 +1,16 @@
+#include <string.h>
+#include <netdb.h>
+#include <sys/system_properties.h>
+
+#include "gethostsfile.h"
+
+const char *gethostsfile() {
+ char hosts_setting[128];
+ int prop_len = __system_property_get(AICP_HOSTS_SETTING_PROP,
+ hosts_setting);
+ if (prop_len > 0 && strncmp(hosts_setting, "true", 4) == 0) {
+ return AICP_PATH_ADBLOCK_HOSTS;
+ } else {
+ return _PATH_HOSTS;
+ }
+}