linux-user: waitid leaves target siginfo uninitialized when info.si_pid is zero
when called with WNOHANG and no child has exited, waitid returns with info.si_pid set to zero and because there is an unnecessary check for info.si_pid != 0 this will cause target siginfo structure to be uninitialized.
Suggested fix is to remove the check:
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5950222a77..b80531ac4c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8724,9 +8724,8 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_waitid:
{
siginfo_t info;
- info.si_pid = 0;
ret = get_errno(safe_waitid(arg1, arg2, &info, arg4, NULL));
- if (!is_error(ret) && arg3 && info.si_pid != 0) {
+ if (!is_error(ret) && arg3) {
if (!(p = lock_user(VERIFY_WRITE, arg3, sizeof(target_siginfo_t), 0)))
return -TARGET_EFAULT;
host_to_target_siginfo(p, &info);
Edited by Serge Belyshev