summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-08 17:57:12 +0100
committerVolker Lendecke <vlendec@samba.org>2011-02-28 16:40:19 +0100
commita2970dfaef9ceac6af2784cbffe9e2d8ac14b188 (patch)
tree8d5cac552ed2289661577cfaaa5b5e1f9febb835 /source3
parente6f820835874e6bbf103768665952b7884cd8452 (diff)
downloadsamba-a2970dfaef9ceac6af2784cbffe9e2d8ac14b188.tar.gz
samba-a2970dfaef9ceac6af2784cbffe9e2d8ac14b188.tar.bz2
samba-a2970dfaef9ceac6af2784cbffe9e2d8ac14b188.zip
s3: Eliminate sys_select_intr from read_fd_with_timeout
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sock.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 51de68f4c3..73b69b4440 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -446,11 +446,9 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
unsigned int time_out,
size_t *size_ret)
{
- fd_set fds;
- int selrtn;
+ int pollrtn;
ssize_t readret;
size_t nread = 0;
- struct timeval timeout;
/* just checking .... */
if (maxcnt <= 0)
@@ -485,23 +483,20 @@ NTSTATUS read_fd_with_timeout(int fd, char *buf,
system performance will suffer severely as
select always returns true on disk files */
- /* Set initial timeout */
- timeout.tv_sec = (time_t)(time_out / 1000);
- timeout.tv_usec = (long)(1000 * (time_out % 1000));
-
for (nread=0; nread < mincnt; ) {
- FD_ZERO(&fds);
- FD_SET(fd,&fds);
+ int revents;
- selrtn = sys_select_intr(fd+1,&fds,NULL,NULL,&timeout);
+ pollrtn = poll_intr_one_fd(fd, POLLIN|POLLHUP, time_out,
+ &revents);
/* Check if error */
- if (selrtn == -1) {
+ if (pollrtn == -1) {
return map_nt_error_from_unix(errno);
}
/* Did we timeout ? */
- if (selrtn == 0) {
+ if ((pollrtn == 0) ||
+ ((revents & (POLLIN|POLLHUP|POLLERR)) == 0)) {
DEBUG(10,("read_fd_with_timeout: timeout read. "
"select timed out.\n"));
return NT_STATUS_IO_TIMEOUT;