static bool fd_is_readable(int fd)
{
- fd_set fds;
- struct timeval timeout = {0, };
- int ret;
+ int ret, revents;
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
+ ret = poll_one_fd(fd, POLLIN|POLLHUP, 0, &revents);
+
+ return ((ret > 0) && ((revents & (POLLIN|POLLHUP|POLLERR)) != 0));
- ret = sys_select(fd+1, &fds, NULL, NULL, &timeout);
- if (ret == -1) {
- return false;
- }
- return FD_ISSET(fd, &fds);
}
static void smbd_server_connection_write_handler(struct smbd_server_connection *conn)