Merge "Move errno to a pthread_internal_t field."
diff --git a/libc/tzcode/bionic.cpp b/libc/tzcode/bionic.cpp
index 51fd39a..cb9c359 100644
--- a/libc/tzcode/bionic.cpp
+++ b/libc/tzcode/bionic.cpp
@@ -200,15 +200,29 @@
   int fd;
 
 #if defined(__ANDROID__)
-  // On Android, try the three hard-coded locations.
+  // On Android devices, try the four hard-coded locations in order.
+  //
+  // 1: The O-MR1 time zone updates via APK update mechanism. This is
+  // tried first because it allows us to test that the time zone updates
+  // via APK mechanism still works even on devices with the time zone
+  // module.
   fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
                                  olson_id, entry_length);
   if (fd >= 0) return fd;
 
-  fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tzdata",
+  // 2: The time zone data module which may contain newer data on
+  // devices that support module updates.
+  fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
                                  olson_id, entry_length);
   if (fd >= 0) return fd;
 
+  // 3: The runtime module, which should exist even on devices that
+  // do not support APEX file updates.
+  fd = __bionic_open_tzdata_path("/apex/com.android.runtime/etc/tz/tzdata",
+                                 olson_id, entry_length);
+  if (fd >= 0) return fd;
+
+  // 4: The ultimate fallback: the non-updatable copy in /system.
   fd = __bionic_open_tzdata_path("/system/usr/share/zoneinfo/tzdata",
                                  olson_id, entry_length);
   if (fd >= 0) return fd;
diff --git a/linker/linker.cpp b/linker/linker.cpp
index b437f06..1f259e1 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3879,7 +3879,7 @@
 
   std::vector<android_namespace_t*> created_namespaces;
   created_namespaces.reserve(namespaces.size());
-  for (auto kv : namespaces) {
+  for (const auto& kv : namespaces) {
     created_namespaces.push_back(kv.second);
   }
   return created_namespaces;
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 391c8a9..ac4c1fd 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -489,7 +489,7 @@
 
   g_config.set_target_sdk_version(target_sdk_version);
 
-  for (auto ns_config_it : namespace_configs) {
+  for (const auto& ns_config_it : namespace_configs) {
     auto& name = ns_config_it.first;
     NamespaceConfig* ns_config = ns_config_it.second;