summaryrefslogtreecommitdiff
path: root/libs/binder/RpcServer.cpp
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-11-14 11:33:10 -0800
committer Tomasz Wasilczyk <twasilczyk@google.com> 2023-11-14 11:36:06 -0800
commitbfb13a8860abce921e6fe832e9fc06d1ec58d5c4 (patch)
tree1605c1b55b5f0c2abb524cfa54c39ecc450540f6 /libs/binder/RpcServer.cpp
parent7ba2e7ea7a44994ba0da16d906510f275233c1ee (diff)
Use unique_fd::ok() instead of -1 comparison
Test: mma Bug: 302723053 Change-Id: I744bdfe735624ad9f95a7d448919e7bd2e430098
Diffstat (limited to 'libs/binder/RpcServer.cpp')
-rw-r--r--libs/binder/RpcServer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 1ba20b3103..fefaa810d2 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -168,7 +168,7 @@ void RpcServer::setConnectionFilter(std::function<bool(const void*, size_t)>&& f
void RpcServer::setServerSocketModifier(std::function<void(base::borrowed_fd)>&& modifier) {
RpcMutexLockGuard _l(mLock);
- LOG_ALWAYS_FATAL_IF(mServer.fd != -1, "Already started");
+ LOG_ALWAYS_FATAL_IF(mServer.fd.ok(), "Already started");
mServerSocketModifier = std::move(modifier);
}
@@ -200,7 +200,7 @@ void RpcServer::start() {
status_t RpcServer::acceptSocketConnection(const RpcServer& server, RpcTransportFd* out) {
RpcTransportFd clientSocket(unique_fd(TEMP_FAILURE_RETRY(
accept4(server.mServer.fd.get(), nullptr, nullptr, SOCK_CLOEXEC | SOCK_NONBLOCK))));
- if (clientSocket.fd < 0) {
+ if (!clientSocket.fd.ok()) {
int savedErrno = errno;
ALOGE("Could not accept4 socket: %s", strerror(savedErrno));
return -savedErrno;