Refactor tio_wait()
Refactor tio_wait()

This changes the function to accept a file descriptor, an event and
timeout parameter directly instead of a confusing flag.

arthurdejong/nss-pam-ldapd,arthurdejong/nss-pam-ldapd,arthurdejong/nss-pam-ldapd