if (ret <= 0) {
if (ret < 0) {
- LOGW("receiving file descriptor from ADB failed (socket %d): %s",
+ ALOGW("receiving file descriptor from ADB failed (socket %d): %s",
netState->controlSock, strerror(errno));
}
close(netState->controlSock);
netState->controlSock = socket(PF_UNIX, SOCK_STREAM, 0);
if (netState->controlSock < 0) {
- LOGE("Could not create ADB control socket:%s",
+ ALOGE("Could not create ADB control socket:%s",
strerror(errno));
return false;
}
if (pipe(netState->wakeFds) < 0) {
- LOGE("pipe failed");
+ ALOGE("pipe failed");
return false;
}
if (!ret) {
if (!socket_peer_is_trusted(netState->controlSock)) {
if (shutdown(netState->controlSock, SHUT_RDWR)) {
- LOGE("trouble shutting down socket: %s", strerror(errno));
+ ALOGE("trouble shutting down socket: %s", strerror(errno));
}
return false;
}
break;
}
- LOGE("Weird, can't send JDWP process pid to ADB: %s",
+ ALOGE("Weird, can't send JDWP process pid to ADB: %s",
strerror(errno));
return false;
}
if (netState->clientSock < 0) {
if (++retryCount > 5) {
- LOGE("adb connection max retries exceeded");
+ ALOGE("adb connection max retries exceeded");
return false;
}
goto retry;
if (netState->wakeFds[1] >= 0) {
ALOGV("+++ writing to wakePipe");
- write(netState->wakeFds[1], "", 1);
+ TEMP_FAILURE_RETRY(write(netState->wakeFds[1], "", 1));
}
}
ssize_t cc = netState->writePacket(pReply);
if (cc != (ssize_t) expandBufGetLength(pReply)) {
- LOGE("Failed sending reply to debugger: %s", strerror(errno));
+ ALOGE("Failed sending reply to debugger: %s", strerror(errno));
expandBufFree(pReply);
return false;
}
} else {
- LOGW("No reply created for set=%d cmd=%d", cmdSet, cmd);
+ ALOGW("No reply created for set=%d cmd=%d", cmdSet, cmd);
}
expandBufFree(pReply);
} else {
if (maxfd < fd)
maxfd = fd;
} else {
- LOGI("NOTE: entering select w/o wakepipe");
+ ALOGI("NOTE: entering select w/o wakepipe");
}
if (maxfd < 0) {
if (selCount < 0) {
if (errno == EINTR)
continue;
- LOGE("select failed: %s", strerror(errno));
+ ALOGE("select failed: %s", strerror(errno));
goto fail;
}
if (netState->wakeFds[0] >= 0 &&
FD_ISSET(netState->wakeFds[0], &readfds))
{
- LOGD("Got wake-up signal, bailing out of select");
+ ALOGD("Got wake-up signal, bailing out of select");
goto fail;
}
if (netState->controlSock >= 0 &&
{
int sock = receiveClientFd(netState);
if (sock >= 0) {
- LOGI("Ignoring second debugger -- accepting and dropping");
+ ALOGI("Ignoring second debugger -- accepting and dropping");
close(sock);
} else {
assert(netState->controlSock < 0);
/* read failed */
if (errno != EINTR)
goto fail;
- LOGD("+++ EINTR hit");
+ ALOGD("+++ EINTR hit");
return true;
} else if (readCount == 0) {
/* EOF hit -- far end went away */
if (memcmp(netState->inputBuffer,
kMagicHandshake, kMagicHandshakeLen) != 0)
{
- LOGE("ERROR: bad handshake '%.14s'", netState->inputBuffer);
+ ALOGE("ERROR: bad handshake '%.14s'", netState->inputBuffer);
goto fail;
}
errno = 0;
- cc = write(netState->clientSock, netState->inputBuffer,
- kMagicHandshakeLen);
+ cc = TEMP_FAILURE_RETRY(write(netState->clientSock, netState->inputBuffer,
+ kMagicHandshakeLen));
if (cc != kMagicHandshakeLen) {
- LOGE("Failed writing handshake bytes: %s (%d of %d)",
+ ALOGE("Failed writing handshake bytes: %s (%d of %d)",
strerror(errno), cc, (int) kMagicHandshakeLen);
goto fail;
}
ssize_t cc = netState->writePacket(pReq);
if (cc != (ssize_t) expandBufGetLength(pReq)) {
- LOGE("Failed sending req to debugger: %s (%d of %d)",
+ ALOGE("Failed sending req to debugger: %s (%d of %d)",
strerror(errno), (int) cc, (int) expandBufGetLength(pReq));
return false;
}
ssize_t actual = netState->writeBufferedPacket(iov, iovcnt);
if ((size_t)actual != expected) {
- LOGE("Failed sending b-req to debugger: %s (%d of %zu)",
+ ALOGE("Failed sending b-req to debugger: %s (%d of %zu)",
strerror(errno), (int) actual, expected);
return false;
}