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

Commit 1480dc3e authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Zygote: Unblock SIGCHLD in the parent after fork.



Follow up to change e9a52582. Allows the zygote to
receive SIGCHLD again and prevents the zygote from getting into a
zombie state if it's killed.

Change-Id: I81fde39a2dd32eaf7d8b397672d3165a4eb945e1
Contributed-By: default avatarrhed_jao <rhed_jao@htc.com>
Bug: 32693692
Test: manual
parent e9a52582
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -628,6 +628,12 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra
    }
  } else if (pid > 0) {
    // the parent process

    // We blocked SIGCHLD prior to a fork, we unblock it here.
    if (sigprocmask(SIG_UNBLOCK, &sigchld, nullptr) == -1) {
      ALOGE("sigprocmask(SIG_SETMASK, { SIGCHLD }) failed: %s", strerror(errno));
      RuntimeAbort(env, __LINE__, "Call to sigprocmask(SIG_UNBLOCK, { SIGCHLD }) failed.");
    }
  }
  return pid;
}