Merge "Remove obsolete reference to ddk; Fixes for -Werror" into lmp-dev
diff --git a/adb/adb_auth_client.c b/adb/adb_auth_client.c
index 8409c63..55e9dca 100644
--- a/adb/adb_auth_client.c
+++ b/adb/adb_auth_client.c
@@ -175,7 +175,7 @@
 
     if (events & FDE_READ) {
         ret = unix_read(fd, response, sizeof(response));
-        if (ret < 0) {
+        if (ret <= 0) {
             D("Framework disconnect\n");
             if (usb_transport)
                 fdevent_remove(&usb_transport->auth_fde);
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc
index d460f6f..1eb2d5b 100644
--- a/libnativebridge/native_bridge.cc
+++ b/libnativebridge/native_bridge.cc
@@ -372,15 +372,15 @@
   if (env_values->os_arch != nullptr) {
     jclass sclass_id = env->FindClass("java/lang/System");
     if (sclass_id != nullptr) {
-      jmethodID set_prop_id = env->GetStaticMethodID(sclass_id, "setProperty",
-          "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
+      jmethodID set_prop_id = env->GetStaticMethodID(sclass_id, "initUnchangeableSystemProperty",
+          "(Ljava/lang/String;Ljava/lang/String;)V");
       if (set_prop_id != nullptr) {
-        // Reset os.arch to the value reqired by the apps running with native bridge.
-        env->CallStaticObjectMethod(sclass_id, set_prop_id, env->NewStringUTF("os.arch"),
+        // Init os.arch to the value reqired by the apps running with native bridge.
+        env->CallStaticVoidMethod(sclass_id, set_prop_id, env->NewStringUTF("os.arch"),
             env->NewStringUTF(env_values->os_arch));
       } else {
         env->ExceptionClear();
-        ALOGW("Could not find setProperty method.");
+        ALOGW("Could not find initUnchangeableSystemProperty method.");
       }
     } else {
       env->ExceptionClear();
diff --git a/libnativebridge/tests/PreInitializeNativeBridge_test.cpp b/libnativebridge/tests/PreInitializeNativeBridge_test.cpp
index 9b487d7..84078f7 100644
--- a/libnativebridge/tests/PreInitializeNativeBridge_test.cpp
+++ b/libnativebridge/tests/PreInitializeNativeBridge_test.cpp
@@ -31,8 +31,8 @@
 static constexpr const char* kTestData = "PreInitializeNativeBridge test.";
 
 TEST_F(NativeBridgeTest, PreInitializeNativeBridge) {
-#ifndef __APPLE_         // Mac OS does not support bind-mount.
-#ifndef HAVE_ANDROID_OS  // Cannot write into the hard-wired location.
+#ifndef __APPLE__         // Mac OS does not support bind-mount.
+#ifndef HAVE_ANDROID_OS   // Cannot write into the hard-wired location.
     // Try to create our mount namespace.
     if (unshare(CLONE_NEWNS) != -1) {
         // Create a dummy file.