summaryrefslogtreecommitdiffstats
path: root/libsysutils
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2012-05-30 15:29:07 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-30 15:29:07 -0700
commit6f523cda13094bf493cdf37e7ecc480bb5a37a2b (patch)
tree6770c133428553ac2e3abb3545afa281813fe4f4 /libsysutils
parent99565a9e80882658e1b4ea5b7c610d40d4d7cb0b (diff)
parent7bb1b9585d2d61beaf05c997971aee27f87ad3f7 (diff)
downloadsystem_core-6f523cda13094bf493cdf37e7ecc480bb5a37a2b.zip
system_core-6f523cda13094bf493cdf37e7ecc480bb5a37a2b.tar.gz
system_core-6f523cda13094bf493cdf37e7ecc480bb5a37a2b.tar.bz2
am 7bb1b958: am ff856a2b: Merge "Add error handling to SocketClient::sendData"
* commit '7bb1b9585d2d61beaf05c997971aee27f87ad3f7': 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 4a1227f..3d4984d 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -131,11 +131,6 @@ char *SocketClient::quoteArg(const char *arg) {
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);
@@ -158,6 +153,11 @@ int SocketClient::sendDataLocked(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;
}