summaryrefslogtreecommitdiff
path: root/libsysutils/src
diff options
context:
space:
mode:
authorJustin DeMartino <jjdemartino@google.com>2020-10-14 19:39:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-10-14 19:39:53 +0000
commit0d11af03e43f110b0bb160f7e20436d0043e3038 (patch)
tree48f8bcca856276ec73a86dd3fb26143d3ca64578 /libsysutils/src
parent075666ebd0dee8d0c4a2efa54f7c324a3f67ee2a (diff)
parenta6c01e4e98d2b343dcecfc99611e2e6250c730db (diff)
Merge changes from topic "SP1A.200921.001" into s-keystone-qcom-dev
* changes: fs_mgr: adb-remount-test.sh: filter out more administrivia mounts. Merge SP1A.200921.001 Change-Id: I90b97c4e9fb10b1f45e74def404823eed5b1aaa8
Diffstat (limited to 'libsysutils/src')
-rw-r--r--libsysutils/src/NetlinkEvent.cpp2
-rw-r--r--libsysutils/src/SocketClient.cpp51
2 files changed, 16 insertions, 37 deletions
diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp
index 9c1621bc8..3b6cfd830 100644
--- a/libsysutils/src/NetlinkEvent.cpp
+++ b/libsysutils/src/NetlinkEvent.cpp
@@ -185,7 +185,6 @@ bool NetlinkEvent::parseIfAddrMessage(const struct nlmsghdr *nh) {
if (!checkRtNetlinkLength(nh, sizeof(*ifaddr)))
return false;
- // Sanity check.
int type = nh->nlmsg_type;
if (type != RTM_NEWADDR && type != RTM_DELADDR) {
SLOGE("parseIfAddrMessage on incorrect message type 0x%x\n", type);
@@ -349,7 +348,6 @@ bool NetlinkEvent::parseRtMessage(const struct nlmsghdr *nh) {
uint8_t type = nh->nlmsg_type;
const char *msgname = rtMessageName(type);
- // Sanity check.
if (type != RTM_NEWROUTE && type != RTM_DELROUTE) {
SLOGE("%s: incorrect message type %d (%s)\n", __func__, type, msgname);
return false;
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index fe2f3d668..e90afcd18 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -201,50 +201,31 @@ int SocketClient::sendDataLockedv(struct iovec *iov, int iovcnt) {
return 0;
}
- int ret = 0;
- int e = 0; // SLOGW and sigaction are not inert regarding errno
int current = 0;
- struct sigaction new_action, old_action;
- memset(&new_action, 0, sizeof(new_action));
- new_action.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &new_action, &old_action);
-
for (;;) {
- ssize_t rc = TEMP_FAILURE_RETRY(
- writev(mSocket, iov + current, iovcnt - current));
-
- if (rc > 0) {
- size_t written = rc;
- while ((current < iovcnt) && (written >= iov[current].iov_len)) {
- written -= iov[current].iov_len;
- current++;
- }
- if (current == iovcnt) {
- break;
- }
- iov[current].iov_base = (char *)iov[current].iov_base + written;
- iov[current].iov_len -= written;
- continue;
- }
+ ssize_t rc = TEMP_FAILURE_RETRY(writev(mSocket, iov + current, iovcnt - current));
if (rc == 0) {
- e = EIO;
+ errno = EIO;
SLOGW("0 length write :(");
- } else {
- e = errno;
- SLOGW("write error (%s)", strerror(e));
+ return -1;
+ } else if (rc < 0) {
+ SLOGW("write error (%s)", strerror(errno));
+ return -1;
}
- ret = -1;
- break;
- }
- sigaction(SIGPIPE, &old_action, &new_action);
-
- if (e != 0) {
- errno = e;
+ size_t written = rc;
+ while (current < iovcnt && written >= iov[current].iov_len) {
+ written -= iov[current].iov_len;
+ current++;
+ }
+ if (current == iovcnt) {
+ return 0;
+ }
+ iov[current].iov_base = (char*)iov[current].iov_base + written;
+ iov[current].iov_len -= written;
}
- return ret;
}
void SocketClient::incRef() {