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

Commit 9735b22f authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "debuggerd_fallback: fix fd leak." am: e26b8b01 am: ffd3922f

am: cf648d6b

Change-Id: Ic17a373cb21ee77767d3b9299796c03ec284eb50
parents 227ff0ce cf648d6b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -250,11 +250,12 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
        }

        uint64_t expected = pack_thread_fd(-1, -1);
        if (!trace_output.compare_exchange_strong(expected,
                                                  pack_thread_fd(tid, pipe_write.release()))) {
        int sent_fd = pipe_write.release();
        if (!trace_output.compare_exchange_strong(expected, pack_thread_fd(tid, sent_fd))) {
          auto [tid, fd] = unpack_thread_fd(expected);
          async_safe_format_log(ANDROID_LOG_ERROR, "libc",
                                "thread %d is already outputting to fd %d?", tid, fd);
          close(sent_fd);
          return false;
        }