Return negative errno (instead of positive) on failure.
http://ag/489245 changed some return values from bools to errno values. However,
in forthcoming CLs, @lorenzo uses the convention of negative errno to indicate
failure. So, be consistent with that style.
Change-Id: I3eac8f142c36a2e779cda289c07ee374c49e2f6b
diff --git a/client/FwmarkClient.cpp b/client/FwmarkClient.cpp
index 03cd5fb..db2009f 100644
--- a/client/FwmarkClient.cpp
+++ b/client/FwmarkClient.cpp
@@ -43,7 +43,7 @@
int FwmarkClient::send(void* data, size_t len, int fd) {
mChannel = socket(AF_UNIX, SOCK_STREAM, 0);
if (mChannel == -1) {
- return errno;
+ return -errno;
}
if (TEMP_FAILURE_RETRY(connect(mChannel, reinterpret_cast<const sockaddr*>(&FWMARK_SERVER_PATH),
@@ -78,13 +78,13 @@
memcpy(CMSG_DATA(cmsgh), &fd, sizeof(fd));
if (TEMP_FAILURE_RETRY(sendmsg(mChannel, &message, 0)) == -1) {
- return errno;
+ return -errno;
}
int error = 0;
if (TEMP_FAILURE_RETRY(recv(mChannel, &error, sizeof(error), 0)) == -1) {
- return errno;
+ return -errno;
}
return error;