Fixing select() and POLL_ERR