summaryrefslogtreecommitdiffstats
path: root/libsysutils
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2012-05-30 15:23:29 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-30 15:23:29 -0700
commit7bb1b9585d2d61beaf05c997971aee27f87ad3f7 (patch)
tree8e932ad0f6147550bc4d2b31d74076bfc8025e70 /libsysutils
parenta802b8374a22da9f52541e1fc286dcbdb1cfa1b4 (diff)
parentff856a2b927aaadb189181d2cd9dd08dc98456a4 (diff)
downloadsystem_core-7bb1b9585d2d61beaf05c997971aee27f87ad3f7.zip
system_core-7bb1b9585d2d61beaf05c997971aee27f87ad3f7.tar.gz
system_core-7bb1b9585d2d61beaf05c997971aee27f87ad3f7.tar.bz2
am ff856a2b: Merge "Add error handling to SocketClient::sendData"
* commit 'ff856a2b927aaadb189181d2cd9dd08dc98456a4': Add error handling to SocketClient::sendData
Diffstat (limited to 'libsysutils')
-rw-r--r--libsysutils/src/SocketClient.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index 722dcb2..69d165a 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/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;
}