I wonder if select on all possible file descriptors in the fd_err parameter would give you a clue as to which were invalid.
Hm... seems like select returns -1 if an invalid descriptor is included. That probably means it won't flag all of them..
-Steve