--- pth_high.c 2002/11/07 15:07:54 1.98
+++ pth_high.c 2002/11/07 15:21:06 1.99
@@ -698,6 +698,7 @@
pth_event_t ev;
static pth_key_t ev_key = PTH_KEY_INIT;
fd_set fds;
+ int fdmode;
int n;
pth_implicit_init();
@@ -709,8 +710,12 @@
if (!pth_util_fd_valid(fd))
return pth_error(-1, EBADF);
+ /* check mode of filedescriptor */
+ if ((fdmode = pth_fdmode(fd, PTH_FDMODE_POLL)) == PTH_FDMODE_ERROR)
+ return pth_error(-1, EBADF);
+
/* poll filedescriptor if not already in non-blocking operation */
- if (pth_fdmode(fd, PTH_FDMODE_POLL) == PTH_FDMODE_BLOCK) {
+ if (fdmode == PTH_FDMODE_BLOCK) {
/* now directly poll filedescriptor for readability
to avoid unneccessary (and resource consuming because of context
@@ -865,6 +870,7 @@
pth_event_t ev;
static pth_key_t ev_key = PTH_KEY_INIT;
fd_set fds;
+ int fdmode;
int n;
pth_implicit_init();
@@ -876,8 +882,12 @@
if (!pth_util_fd_valid(fd))
return pth_error(-1, EBADF);
+ /* check mode of filedescriptor */
+ if ((fdmode = pth_fdmode(fd, PTH_FDMODE_POLL)) == PTH_FDMODE_ERROR)
+ return pth_error(-1, EBADF);
+
/* poll filedescriptor if not already in non-blocking operation */
- if (pth_fdmode(fd, PTH_FDMODE_POLL) == PTH_FDMODE_BLOCK) {
+ if (fdmode == PTH_FDMODE_BLOCK) {
/* first directly poll filedescriptor for readability
to avoid unneccessary (and resource consuming because of context
@@ -1289,6 +1299,7 @@
pth_event_t ev;
static pth_key_t ev_key = PTH_KEY_INIT;
fd_set fds;
+ int fdmode;
int n;
pth_implicit_init();
@@ -1300,8 +1311,12 @@
if (!pth_util_fd_valid(fd))
return pth_error(-1, EBADF);
+ /* check mode of filedescriptor */
+ if ((fdmode = pth_fdmode(fd, PTH_FDMODE_POLL)) == PTH_FDMODE_ERROR)
+ return pth_error(-1, EBADF);
+
/* poll filedescriptor if not already in non-blocking operation */
- if (pth_fdmode(fd, PTH_FDMODE_POLL) == PTH_FDMODE_BLOCK) {
+ if (fdmode == PTH_FDMODE_BLOCK) {
/* now directly poll filedescriptor for readability
to avoid unneccessary (and resource consuming because of context
|