move the out of range pid check into reap_dead_kids

removes duplicate code, and simplifies check_shm_sanity.
Rename it to shm_is_corrupt while we're at it.