common: Fix gnupg_wait_processes, by skipping invalid PID.

* common/exechelp-posix.c (gnupg_wait_processes): Skip invalid PID.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit d82dae5d22)
This commit is contained in:
NIIBE Yutaka 2021-04-08 11:26:58 +09:00 committed by Werner Koch
parent bbf4bd3bfc
commit c2ba6bea4c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 6 additions and 1 deletions

View File

@ -722,8 +722,13 @@ gnupg_wait_processes (const char **pgmnames, pid_t *pids, size_t count,
{
int status = -1;
/* Skip invalid PID. */
if (pids[i] == (pid_t)(-1))
return my_error (GPG_ERR_INV_VALUE);
{
r_exitcodes[i] = -1;
left -= 1;
continue;
}
/* See if there was a previously stored result for this pid. */
if (get_result (pids[i], &status))