Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

am ff856a2: Merge "Add error handling to SocketClient::sendData"

* commit 'ff856a2b927aaadb189181d2cd9dd08dc98456a4':
  Add error handling to SocketClient::sendData
  • Loading branch information...
commit 7bb1b9585d2d61beaf05c997971aee27f87ad3f7 2 parents a802b83 + ff856a2
Robert Greenwalt authored Android Git Automerger committed
Showing with 5 additions and 5 deletions.
  1. +5 −5 libsysutils/src/SocketClient.cpp
View
10 libsysutils/src/SocketClient.cpp
@@ -64,11 +64,6 @@ int SocketClient::sendMsg(int code, const char *msg, bool addErrno) {
}
int SocketClient::sendMsg(const char *msg) {
- if (mSocket < 0) {
- errno = EHOSTUNREACH;
- return -1;
- }
-
// Send the message including null character
if (sendData(msg, strlen(msg) + 1) != 0) {
SLOGW("Unable to send msg '%s'", msg);
@@ -82,6 +77,11 @@ int SocketClient::sendData(const void* data, int len) {
const char *p = (const char*) data;
int brtw = len;
+ if (mSocket < 0) {
+ errno = EHOSTUNREACH;
+ return -1;
+ }
+
if (len == 0) {
return 0;
}
Please sign in to comment.
Something went wrong with that request. Please try again.