Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fd78c92 authored by Josh Gao's avatar Josh Gao
Browse files

adb: detect closed jdwp socket.

If a process opens a JDWP socket, but crashes before writing the full
PID, adbd will spin forever.

Bug: http://b/36411868
Test: none
Change-Id: I1811759e15c3d9c819685c5fc159a566bd4bc842
parent e323976e
Loading
Loading
Loading
Loading
+1 −5
Original line number Original line Diff line number Diff line
@@ -232,11 +232,7 @@ static void jdwp_process_event(int socket, unsigned events, void* _proc) {
            size_t size = PID_LEN - proc->in_len;
            size_t size = PID_LEN - proc->in_len;


            ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, p, size, 0));
            ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, p, size, 0));
            if (rc < 0) {
            if (rc <= 0) {
                if (errno == EAGAIN) {
                    return;
                }

                D("failed to read jdwp pid: %s", strerror(errno));
                D("failed to read jdwp pid: %s", strerror(errno));
                goto CloseProcess;
                goto CloseProcess;
            }
            }