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/tzcode/localtime.c b/libc/tzcode/localtime.c
index cf0fd6b..adc2f1b 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -382,7 +382,7 @@
register int fid;
register int stored;
register ssize_t nread;
-#if !defined(__ANDROID__)
+#if !defined(__BIONIC__)
register bool doaccess;
register char *fullname = lsp->fullname;
#endif
@@ -397,7 +397,7 @@
return EINVAL;
}
-#if defined(__ANDROID__)
+#if defined(__BIONIC__)
fid = __bionic_open_tzdata(name);
#else
if (name[0] == ':')
@@ -1308,7 +1308,7 @@
}
#endif
-#if defined(__ANDROID__)
+#if defined(__BIONIC__)
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h> // For __system_property_serial.
#endif
@@ -1316,7 +1316,7 @@
static void
tzset_unlocked(void)
{
-#if defined(__ANDROID__)
+#if defined(__BIONIC__)
// The TZ environment variable is meant to override the system-wide setting.
const char* name = getenv("TZ");
@@ -2174,7 +2174,7 @@
time_t
mktime(struct tm *tmp)
{
-#if __ANDROID__
+#if defined(__BIONIC__)
int saved_errno = errno;
#endif
@@ -2188,7 +2188,7 @@
t = mktime_tzname(lclptr, tmp, true);
unlock();
-#if __ANDROID__
+#if defined(__BIONIC__)
errno = (t == -1) ? EOVERFLOW : saved_errno;
#endif
return t;
diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c
index b1e0d1c..c05f6b5 100644
--- a/libc/tzcode/strftime.c
+++ b/libc/tzcode/strftime.c
@@ -39,7 +39,7 @@
#include "fcntl.h"
#include "locale.h"
-#if __ANDROID__
+#if defined(__BIONIC__)
/* LP32 had a 32-bit time_t, so we need to work around that here. */
#if defined(__LP64__)