wait and waitpid were fine. muggins wasn't.

Simplify the wrapping of wait by using waitpid (again). On further
inspection, it was an incorrect pid being returned from the waitpid
wrapper that caused errors. This commit (re)-simplifies the code.