The handling of errors returned by pselect() is not correct. According to the pselect() man page, the fd sets are not modified when an error is returned, thus they cannot be used to figure out which fd caused the error. I recognize the code that looks specifically for EBADF and EHOSTDOWN from early work with TCP sockets, figuring out what would happen when the network connection breaks. That will need to be revisited.
The handling of errors returned by pselect() is not correct. According to the pselect() man page, the fd sets are not modified when an error is returned, thus they cannot be used to figure out which fd caused the error. I recognize the code that looks specifically for EBADF and EHOSTDOWN from early work with TCP sockets, figuring out what would happen when the network connection breaks. That will need to be revisited.