diff options
author | 2021-04-02 01:13:36 +0000 | |
---|---|---|
committer | 2021-04-02 01:46:37 +0000 | |
commit | c6ddf36337552a94223d35a94c911ba979b3bc94 (patch) | |
tree | dfa97df95ac0cd4589fb3513155520f964122d51 /libs/binder/RpcState.cpp | |
parent | 8911d46baf682d95a08efd678aaee7fc15c9767a (diff) |
libbinder: RPC avoid SIGPIPE
This was just being ignored before in our tests, but we can use
MSG_NOSIGNAL to avoid this.
Fixes: 183141167
Test: binderRpcTest on host and device (including after removing
RpcState::terminate which was avoiding SIGPIPE in at least some
cases)
Change-Id: I7c84fc28ff21400f2546f88403a79fae8985c4b7
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r-- | libs/binder/RpcState.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index 64e842e927..3b3adca34f 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -192,7 +192,7 @@ bool RpcState::rpcSend(const base::unique_fd& fd, const char* what, const void* return false; } - ssize_t sent = TEMP_FAILURE_RETRY(send(fd.get(), data, size, 0)); + ssize_t sent = TEMP_FAILURE_RETRY(send(fd.get(), data, size, MSG_NOSIGNAL)); if (sent < 0 || sent != static_cast<ssize_t>(size)) { ALOGE("Failed to send %s (sent %zd of %zu bytes) on fd %d, error: %s", what, sent, size, @@ -212,7 +212,7 @@ bool RpcState::rpcRec(const base::unique_fd& fd, const char* what, void* data, s return false; } - ssize_t recd = TEMP_FAILURE_RETRY(recv(fd.get(), data, size, MSG_WAITALL)); + ssize_t recd = TEMP_FAILURE_RETRY(recv(fd.get(), data, size, MSG_WAITALL | MSG_NOSIGNAL)); if (recd < 0 || recd != static_cast<ssize_t>(size)) { terminate(); |