Loading adb/transport_local.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -225,7 +225,7 @@ static void qemu_socket_thread(void* arg) { static const char _ok_resp[] = "ok"; static const char _ok_resp[] = "ok"; const int port = (int) (uintptr_t) arg; const int port = (int) (uintptr_t) arg; int res, fd; int fd; char tmp[256]; char tmp[256]; char con_name[32]; char con_name[32]; Loading @@ -251,19 +251,19 @@ static void qemu_socket_thread(void* arg) { */ */ /* Send the 'accept' request. */ /* Send the 'accept' request. */ res = adb_write(fd, _accept_req, strlen(_accept_req)); if (WriteFdExactly(fd, _accept_req, strlen(_accept_req))) { if ((size_t)res == strlen(_accept_req)) { /* Wait for the response. In the response we expect 'ok' on success, /* Wait for the response. In the response we expect 'ok' on success, * or 'ko' on failure. */ * or 'ko' on failure. */ res = adb_read(fd, tmp, sizeof(tmp)); if (!ReadFdExactly(fd, tmp, 2) || memcmp(tmp, _ok_resp, 2)) { if (res != 2 || memcmp(tmp, _ok_resp, 2)) { D("Accepting ADB host connection has failed."); D("Accepting ADB host connection has failed."); adb_close(fd); adb_close(fd); } else { } else { /* Host is connected. Register the transport, and start the /* Host is connected. Register the transport, and start the * exchange. */ * exchange. */ register_socket_transport(fd, "host", port, 1); register_socket_transport(fd, "host", port, 1); adb_write(fd, _start_req, strlen(_start_req)); if (!WriteFdExactly(fd, _start_req, strlen(_start_req))) { adb_close(fd); } } } /* Prepare for accepting of the next ADB host connection. */ /* Prepare for accepting of the next ADB host connection. */ Loading Loading
adb/transport_local.cpp +6 −6 Original line number Original line Diff line number Diff line Loading @@ -225,7 +225,7 @@ static void qemu_socket_thread(void* arg) { static const char _ok_resp[] = "ok"; static const char _ok_resp[] = "ok"; const int port = (int) (uintptr_t) arg; const int port = (int) (uintptr_t) arg; int res, fd; int fd; char tmp[256]; char tmp[256]; char con_name[32]; char con_name[32]; Loading @@ -251,19 +251,19 @@ static void qemu_socket_thread(void* arg) { */ */ /* Send the 'accept' request. */ /* Send the 'accept' request. */ res = adb_write(fd, _accept_req, strlen(_accept_req)); if (WriteFdExactly(fd, _accept_req, strlen(_accept_req))) { if ((size_t)res == strlen(_accept_req)) { /* Wait for the response. In the response we expect 'ok' on success, /* Wait for the response. In the response we expect 'ok' on success, * or 'ko' on failure. */ * or 'ko' on failure. */ res = adb_read(fd, tmp, sizeof(tmp)); if (!ReadFdExactly(fd, tmp, 2) || memcmp(tmp, _ok_resp, 2)) { if (res != 2 || memcmp(tmp, _ok_resp, 2)) { D("Accepting ADB host connection has failed."); D("Accepting ADB host connection has failed."); adb_close(fd); adb_close(fd); } else { } else { /* Host is connected. Register the transport, and start the /* Host is connected. Register the transport, and start the * exchange. */ * exchange. */ register_socket_transport(fd, "host", port, 1); register_socket_transport(fd, "host", port, 1); adb_write(fd, _start_req, strlen(_start_req)); if (!WriteFdExactly(fd, _start_req, strlen(_start_req))) { adb_close(fd); } } } /* Prepare for accepting of the next ADB host connection. */ /* Prepare for accepting of the next ADB host connection. */ Loading