Don't log the warning for an expected kill am: 1403606682 am: 7b8d84c130 am: 9f3eb16c0f
Original change: https://android-review.googlesource.com/c/platform/external/minijail/+/1692726
Change-Id: I51b3cd6b172e7332848694abde9be5671f6c351b
diff --git a/libminijail.c b/libminijail.c
index e0d9d54..b09a05c 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -3349,18 +3349,7 @@
return ret;
}
-int API minijail_kill(struct minijail *j)
-{
- if (j->initpid <= 0)
- return -ECHILD;
-
- if (kill(j->initpid, SIGTERM))
- return -errno;
-
- return minijail_wait(j);
-}
-
-int API minijail_wait(struct minijail *j)
+static int minijail_wait_internal(struct minijail *j, int expected_signal)
{
if (j->initpid <= 0)
return -ECHILD;
@@ -3378,8 +3367,10 @@
int error_status = st;
if (WIFSIGNALED(st)) {
int signum = WTERMSIG(st);
- warn("child process %d received signal %d",
- j->initpid, signum);
+ if (signum != expected_signal) {
+ warn("child process %d received signal %d",
+ j->initpid, signum);
+ }
/*
* We return MINIJAIL_ERR_JAIL if the process received
* SIGSYS, which happens when a syscall is blocked by
@@ -3404,6 +3395,22 @@
return exit_status;
}
+int API minijail_kill(struct minijail *j)
+{
+ if (j->initpid <= 0)
+ return -ECHILD;
+
+ if (kill(j->initpid, SIGTERM))
+ return -errno;
+
+ return minijail_wait_internal(j, SIGTERM);
+}
+
+int API minijail_wait(struct minijail *j)
+{
+ return minijail_wait_internal(j, 0);
+}
+
void API minijail_destroy(struct minijail *j)
{
size_t i;