libbinder: return error correctly in RpcTransportTipcAndroid
The callback passed to interruptableReadOrWrite is expected
to emulate read() so it should return -1 on error and set errno.
This fixes the RpcTransportTipcAndroid implementation to do
that instead of returning the error directly.
Bug: 224644083
Test: presubmit
Change-Id: I486bb8db2abc4c519ebce3f4f9c0ec8741f69ff4
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;