binder: TLS checks trigger properly.
Previously, libbinder_tls ignores the result of
isTriggeredPolled() by always returning OK regardless
of whether the shutdown trigger is triggered or not, causing
program to continue when it shouldn't be. Return the status
properly like FdTrigger::triggerablePoll:
- If any error during poll() return the code
- If shutdown, return -ECANCELED (new in this CL for TLS)
- Otherwise return OK
Refactor RpcTransportTest so that we can add a new test
to check that trigerablePoll() returns -ECANCELED in the
above case.
Test: binderRpcTest
Fixes: 199309623
Change-Id: Ia545ba71cc10be5c46f722a5d3e699f89e1bc70c
diff --git a/libs/binder/RpcTransportTls.cpp b/libs/binder/RpcTransportTls.cpp
index d40cfc8..63f9339 100644
--- a/libs/binder/RpcTransportTls.cpp
+++ b/libs/binder/RpcTransportTls.cpp
@@ -347,7 +347,7 @@
ALOGE("%s: %s", __PRETTY_FUNCTION__, ret.error().message().c_str());
return ret.error().code() == 0 ? UNKNOWN_ERROR : -ret.error().code();
}
- return OK;
+ return *ret ? -ECANCELED : OK;
}
status_t RpcTransportTls::interruptableWriteFully(FdTrigger* fdTrigger, const void* data,