* commit '7bb1b9585d2d61beaf05c997971aee27f87ad3f7': Add error handling to SocketClient::sendData
This commit is contained in:
commit
6f523cda13
1 changed files with 5 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue