Merge "adb: check return value of register_socket_transport."

This commit is contained in:
Yabin Cui 2016-05-21 01:12:35 +00:00 committed by Gerrit Code Review
commit 3d981c87c9
1 changed files with 5 additions and 3 deletions

View File

@ -167,7 +167,9 @@ static void server_socket_thread(void* arg) {
D("server: new connection on fd %d", fd);
close_on_exec(fd);
disable_tcp_nagle(fd);
register_socket_transport(fd, "host", port, 1);
if (register_socket_transport(fd, "host", port, 1) != 0) {
adb_close(fd);
}
}
}
D("transport: server_socket_thread() exiting");
@ -261,8 +263,8 @@ static void qemu_socket_thread(void* arg) {
/* Host is connected. Register the transport, and start the
* exchange. */
std::string serial = android::base::StringPrintf("host-%d", fd);
register_socket_transport(fd, serial.c_str(), port, 1);
if (!WriteFdExactly(fd, _start_req, strlen(_start_req))) {
if (register_socket_transport(fd, serial.c_str(), port, 1) != 0 ||
!WriteFdExactly(fd, _start_req, strlen(_start_req))) {
adb_close(fd);
}
}