Merge "libbinder: return error correctly in RpcTransportTipcAndroid" am: 62bb50a6ed am: 02a1709067 am: 3ce90ee7c8

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2189663

Change-Id: I10db65750744180c2010967057e86a7339d97089
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/binder/RpcTransportTipcAndroid.cpp b/libs/binder/RpcTransportTipcAndroid.cpp
index 79983f4..c82201b 100644
--- a/libs/binder/RpcTransportTipcAndroid.cpp
+++ b/libs/binder/RpcTransportTipcAndroid.cpp
@@ -103,7 +103,10 @@
             // read and call readFn as many times as needed to get all the data
             status_t ret = fillReadBuffer();
             if (ret != OK) {
-                return ret;
+                // We need to emulate a Linux read call, which sets errno on
+                // error and returns -1
+                errno = -ret;
+                return -1;
             }
 
             ssize_t processSize = 0;