common: Improve waiting for processes on POSIX.
authorJustus Winter <justus@g10code.com>
Mon, 5 Sep 2016 11:50:17 +0000 (13:50 +0200)
committerJustus Winter <justus@g10code.com>
Mon, 5 Sep 2016 12:05:19 +0000 (14:05 +0200)
commite33111fcdac08ed2ddfbdf59b1f790569b42f695
treefe44a6f32435777fd1869f6bf25bb8e9c1784b4c
parentc39be0add8835c9bcc25bdd40e99e828aca56204
common: Improve waiting for processes on POSIX.

* common/exechelp-posix.c (struct terminated_child): New definition.
(terminated_children): New variable.
(store_result): New function.
(get_result): Likewise.
(gnupg_wait_process): Store results that were not requested and
consider previously stored results.

waitpid(2) may return information about terminated children that we
did not yet request, and there is no portable way to wait for a
specific set of children.  As a workaround, we store the results of
children for later use.

Signed-off-by: Justus Winter <justus@g10code.com>
common/exechelp-posix.c