Merge "Fix deprecated range_x() calls."
diff --git a/libc/Android.bp b/libc/Android.bp
index 00932de..f326db3 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1649,6 +1649,9 @@
         keep_symbols: true,
     },
 
+    // Do not pack libc.so relocations; see http://b/20645321 for details.
+    pack_relocations: false,
+
     // WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
     // make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
     // ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
diff --git a/libc/bionic/bionic_arc4random.cpp b/libc/bionic/bionic_arc4random.cpp
index d20cb68..429ff7f 100644
--- a/libc/bionic/bionic_arc4random.cpp
+++ b/libc/bionic/bionic_arc4random.cpp
@@ -38,7 +38,7 @@
 #include "private/libc_logging.h"
 
 void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args) {
-  static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) == -1 && errno != ENOSYS;
+  static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) != -1 || errno != ENOSYS;
   static bool have_urandom = access("/dev/urandom", R_OK) == 0;
   static size_t at_random_bytes_consumed = 0;
 
diff --git a/libc/bionic/wctype.cpp b/libc/bionic/wctype.cpp
index 05e9c90..3a880d3 100644
--- a/libc/bionic/wctype.cpp
+++ b/libc/bionic/wctype.cpp
@@ -34,20 +34,22 @@
 #include <string.h>
 #include <wchar.h>
 
-// TODO: these only work for the ASCII range; rewrite to dlsym icu4c? http://b/14499654
-
-int iswalnum(wint_t wc) { return isalnum(wc); }
-int iswalpha(wint_t wc) { return isalpha(wc); }
+// These functions are either defined to be the same as their ASCII cousins,
+// or defined in terms of other functions.
+int iswalnum(wint_t wc) { return iswdigit(wc) || iswalpha(wc); }
 int iswblank(wint_t wc) { return isblank(wc); }
-int iswcntrl(wint_t wc) { return iscntrl(wc); }
 int iswdigit(wint_t wc) { return isdigit(wc); }
-int iswgraph(wint_t wc) { return isgraph(wc); }
-int iswlower(wint_t wc) { return islower(wc); }
+int iswgraph(wint_t wc) { return !iswspace(wc) && iswprint(wc); }
+int iswlower(wint_t wc) { return towlower(wc) != wc; }
+int iswupper(wint_t wc) { return towupper(wc) != wc; }
+int iswxdigit(wint_t wc) { return isxdigit(wc); }
+
+// TODO: need proper implementations of these.
+int iswalpha(wint_t wc) { return isalpha(wc); }
+int iswcntrl(wint_t wc) { return iscntrl(wc); }
 int iswprint(wint_t wc) { return isprint(wc); }
 int iswpunct(wint_t wc) { return ispunct(wc); }
 int iswspace(wint_t wc) { return isspace(wc); }
-int iswupper(wint_t wc) { return isupper(wc); }
-int iswxdigit(wint_t wc) { return isxdigit(wc); }
 
 int iswalnum_l(wint_t c, locale_t) { return iswalnum(c); }
 int iswalpha_l(wint_t c, locale_t) { return iswalpha(c); }
@@ -84,6 +86,7 @@
   return iswctype(wc, char_class);
 }
 
+// TODO: need proper implementations of these.
 wint_t towlower(wint_t wc) { return tolower(wc); }
 wint_t towupper(wint_t wc) { return toupper(wc); }