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

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

debuggerd_handler: don't use clone(..., SIGCHLD, ...) am: b3ee52e4

am: 6e121639

Change-Id: I7c965000f736b38fe288333a0c610b8684a00392
parents cf32d85d 6e121639
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
  }

  // Don't use fork(2) to avoid calling pthread_atfork handlers.
  int forkpid = clone(nullptr, nullptr, SIGCHLD, nullptr);
  int forkpid = clone(nullptr, nullptr, 0, nullptr);
  if (forkpid == -1) {
    __libc_format_log(ANDROID_LOG_FATAL, "libc", "failed to fork in debuggerd signal handler: %s",
                      strerror(errno));
@@ -248,10 +248,12 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
    close(pipefds[0]);

    // Don't leave a zombie child.
    siginfo_t child_siginfo;
    if (TEMP_FAILURE_RETRY(waitid(P_PID, forkpid, &child_siginfo, WEXITED)) != 0) {
    int status;
    if (TEMP_FAILURE_RETRY(waitpid(forkpid, &status, __WCLONE)) == -1 && errno != ECHILD) {
      __libc_format_log(ANDROID_LOG_FATAL, "libc", "failed to wait for crash_dump helper: %s",
                        strerror(errno));
    } else if (WIFSTOPPED(status) || WIFSIGNALED(status)) {
      __libc_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped");
      thread_info->crash_dump_started = false;
    }
  }