Merge "Add timeout support to android::base::WaitForProperty."
diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp
index ac05d4c..c08b922 100644
--- a/adb/daemon/usb.cpp
+++ b/adb/daemon/usb.cpp
@@ -319,7 +319,7 @@
     D("[ adb: cannot call endpoint alloc: errno=%d ]", errno);
     // Kernel pre-allocation could have failed for recoverable reasons.
     // Continue running with a safe max rw size.
-    h->max_rw *= 2;
+    h->max_rw = USB_FFS_BULK_SIZE;
     return true;
 
 err:
diff --git a/init/README.md b/init/README.md
index c76a33b..d3dd73a 100644
--- a/init/README.md
+++ b/init/README.md
@@ -26,7 +26,7 @@
 Init .rc Files
 --------------
 The init language is used in plain text files that take the .rc file
-extension.  These are typically multiple of these in multiple
+extension.  There are typically multiple of these in multiple
 locations on the system, described below.
 
 /init.rc is the primary .rc file and is loaded by the init executable
diff --git a/liblog/logd_reader.c b/liblog/logd_reader.c
index ccc7da8..a6c3f7a 100644
--- a/liblog/logd_reader.c
+++ b/liblog/logd_reader.c
@@ -91,7 +91,7 @@
 
 static int logdAvailable(log_id_t logId)
 {
-    if (logId > LOG_ID_KERNEL) {
+    if (logId >= LOG_ID_MAX) {
         return -EINVAL;
     }
     if (logId == LOG_ID_SECURITY) {
diff --git a/liblog/logd_writer.c b/liblog/logd_writer.c
index 2bab92e..12b797d 100644
--- a/liblog/logd_writer.c
+++ b/liblog/logd_writer.c
@@ -117,7 +117,7 @@
 
 static int logdAvailable(log_id_t logId)
 {
-    if (logId > LOG_ID_SECURITY) {
+    if (logId >= LOG_ID_MAX || logId == LOG_ID_KERNEL) {
         return -EINVAL;
     }
     if (atomic_load(&logdLoggerWrite.context.sock) < 0) {
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 15cef1a..7f852d4 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -1231,8 +1231,11 @@
                     android::close_error(context);
                     context->stderr_stdout = true;
                     context->output = fp;
-                    context->error = context->output;
-                    if (context->stderr_null) context->error = NULL;
+                    context->output_fd = fileno(fp);
+                    if (context->stderr_null) break;
+                    context->stderr_stdout = true;
+                    context->error = fp;
+                    context->error_fd = fileno(fp);
                 }
                 break;