Fix infinite CPU usage on waitpid().