--- pth_high.c 2002/01/27 12:39:10 1.82
+++ pth_high.c 2002/01/27 13:15:28 1.83
@@ -411,8 +411,8 @@
FD_ZERO(&wfds);
FD_ZERO(&efds);
for(i = 0; i < nfd; i++) {
- if (pfd[i].fd < 0)
- continue;
+ if (!pth_util_fd_valid(pfd[i].fd))
+ return_errno(-1, EBADF);
if (pfd[i].events & POLLIN)
FD_SET(pfd[i].fd, &rfds);
if (pfd[i].events & POLLOUT)
@@ -600,6 +600,8 @@
/* now directly poll filedescriptor for readability
to avoid unneccessary (and resource consuming because of context
switches, etc) event handling through the scheduler */
+ if (!pth_util_fd_valid(fd))
+ return_errno(-1, EBADF);
FD_ZERO(&fds);
FD_SET(fd, &fds);
delay.tv_sec = 0;
@@ -668,6 +670,10 @@
/* now directly poll filedescriptor for writeability
to avoid unneccessary (and resource consuming because of context
switches, etc) event handling through the scheduler */
+ if (!pth_util_fd_valid(fd)) {
+ pth_fdmode(fd, fdmode);
+ return_errno(-1, EBADF);
+ }
FD_ZERO(&fds);
FD_SET(fd, &fds);
delay.tv_sec = 0;
@@ -758,6 +764,8 @@
/* first directly poll filedescriptor for readability
to avoid unneccessary (and resource consuming because of context
switches, etc) event handling through the scheduler */
+ if (!pth_util_fd_valid(fd))
+ return_errno(-1, EBADF);
FD_ZERO(&fds);
FD_SET(fd, &fds);
delay.tv_sec = 0;
@@ -900,6 +908,12 @@
/* first directly poll filedescriptor for writeability
to avoid unneccessary (and resource consuming because of context
switches, etc) event handling through the scheduler */
+ if (!pth_util_fd_valid(fd)) {
+ pth_fdmode(fd, fdmode);
+ if (iovcnt > sizeof(tiov_stack))
+ free(tiov);
+ return_errno(-1, EBADF);
+ }
FD_ZERO(&fds);
FD_SET(fd, &fds);
delay.tv_sec = 0;
@@ -1177,6 +1191,8 @@
/* now directly poll filedescriptor for readability
to avoid unneccessary (and resource consuming because of context
switches, etc) event handling through the scheduler */
+ if (!pth_util_fd_valid(fd))
+ return_errno(-1, EBADF);
FD_ZERO(&fds);
FD_SET(fd, &fds);
delay.tv_sec = 0;
@@ -1257,6 +1273,10 @@
/* now directly poll filedescriptor for writeability
to avoid unneccessary (and resource consuming because of context
switches, etc) event handling through the scheduler */
+ if (!pth_util_fd_valid(fd)) {
+ pth_fdmode(fd, fdmode);
+ return_errno(-1, EBADF);
+ }
FD_ZERO(&fds);
FD_SET(fd, &fds);
delay.tv_sec = 0;
|