From 5dabb4c2d8e3f14faffb3a7dbd943d8b1fb33312 Mon Sep 17 00:00:00 2001 From: Yoshinori Sugino Date: Sun, 29 Nov 2020 13:27:11 +0900 Subject: [PATCH] sched/sched/sched_waitpid.c: Fix return value waitpid should return the process ID of the child whose state has changed even if pid is -1. --- sched/sched/sched_waitpid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sched/sched/sched_waitpid.c b/sched/sched/sched_waitpid.c index 0dd7de6ca5..fbf4fa6f38 100644 --- a/sched/sched/sched_waitpid.c +++ b/sched/sched/sched_waitpid.c @@ -332,6 +332,7 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) /* The child has exited. Return the saved exit status */ *stat_loc = child->ch_status << 8; + pid = child->ch_pid; /* Discard the child entry and break out of the loop */