Fix mktime's errno behavior.

Don't touch errno on success, do set it to EOVERFLOW (the only allowed errno
value according to POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/mktime.html)
on failure.

Bug: http://b/30477946
Change-Id: Ia915c7b9c3bfcd2f9025530cf5b068fe4dd4fd9e
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index 0861015..cf0fd6b 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -2174,6 +2174,10 @@
 time_t
 mktime(struct tm *tmp)
 {
+#if __ANDROID__
+  int saved_errno = errno;
+#endif
+
   time_t t;
   int err = lock();
   if (err) {
@@ -2183,6 +2187,10 @@
   tzset_unlocked();
   t = mktime_tzname(lclptr, tmp, true);
   unlock();
+
+#if __ANDROID__
+  errno = (t == -1) ? EOVERFLOW : saved_errno;
+#endif
   return t;
 }