s3: Eliminate sys_select from fd_is_readable
authorVolker Lendecke <vl@samba.org>
Mon, 7 Feb 2011 16:02:44 +0000 (17:02 +0100)
committerVolker Lendecke <vlendec@samba.org>
Mon, 28 Feb 2011 15:40:19 +0000 (16:40 +0100)
source3/smbd/process.c

index c0f33fd4f8e702b4a317449709e98fc952d86c13..48d317bba294fc11e60288ff2897e5d5098948a4 100644 (file)
@@ -2224,18 +2224,12 @@ static void check_reload(struct smbd_server_connection *sconn, time_t t)
 
 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)