From 8e889a0ed94aa6422be8c078c123cec64774e2c2 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Wed, 23 May 2001 08:30:31 +0000 Subject: Fixed iowatch More clipboard work (Works now in direction Psion -> PC ;-) --- lib/iowatch.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/iowatch.cc') diff --git a/lib/iowatch.cc b/lib/iowatch.cc index 50c03a6..7335d4a 100644 --- a/lib/iowatch.cc +++ b/lib/iowatch.cc @@ -61,14 +61,18 @@ void IOWatch::remIO(const int fd) { bool IOWatch::watch(const long secs, const long usecs) { if (num > 0) { + int maxfd = 0; fd_set iop; FD_ZERO(&iop); - for (int i = 0; i < num; i++) + for (int i = 0; i < num; i++) { FD_SET(io[i], &iop); + if (io[i] > maxfd) + maxfd = io[i]; + } struct timeval t; t.tv_usec = usecs; t.tv_sec = secs; - return (select(io[0]+1, &iop, NULL, NULL, &t) > 0); + return (select(maxfd+1, &iop, NULL, NULL, &t) > 0); } sleep(secs); usleep(usecs); -- cgit v1.2.3