Fix some easy cases of __ANDROID__ versus __BIONIC__.
We need to make a clearer distinction for bionic on the host. This patch
doesn't fully address things like "should host bionic try to talk to netd?"
for now, but is a step in the right direction.
Bug: http://b/31559095
Test: bionic tests.
Change-Id: I49812f8b75d9d78c4fd8a8ddf5df1201d63771d6
diff --git a/libc/dns/resolv/res_init.c b/libc/dns/resolv/res_init.c
index 713b6e0..a5413dd 100644
--- a/libc/dns/resolv/res_init.c
+++ b/libc/dns/resolv/res_init.c
@@ -166,23 +166,23 @@
/* This function has to be reachable by res_data.c but not publicly. */
int
__res_vinit(res_state statp, int preinit) {
-#if !defined(__ANDROID__)
+#if !defined(__BIONIC__)
register FILE *fp;
#endif
register char *cp, **pp;
-#if !defined(__ANDROID__)
+#if !defined(__BIONIC__)
register int n;
#endif
char buf[BUFSIZ];
int nserv = 0; /* number of nameserver records read from file */
-#if !defined(__ANDROID__)
+#if !defined(__BIONIC__)
int haveenv = 0;
#endif
int havesearch = 0;
#ifdef RESOLVSORT
int nsort = 0;
#endif
-#if !defined(__ANDROID__)
+#if !defined(__BIONIC__)
char *net;
#endif
int dots;
@@ -243,7 +243,9 @@
statp->nsort = 0;
res_setservers(statp, u, nserv);
-#if !defined(__ANDROID__) /* IGNORE THE ENVIRONMENT */
+#if defined(__BIONIC__)
+ /* Ignore the environment. */
+#else
/* Allow user to override the local domain definition */
if ((cp = getenv("LOCALDOMAIN")) != NULL) {
(void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);