Index: ossp-pkg/pth/pth_high.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_high.c,v rcsdiff -q -kk '-r1.96' '-r1.97' -u '/v/ossp/cvs/ossp-pkg/pth/pth_high.c,v' 2>/dev/null --- pth_high.c 2002/11/05 19:47:07 1.96 +++ pth_high.c 2002/11/07 13:27:56 1.97 @@ -1310,10 +1310,12 @@ delay.tv_usec = 0; while ((n = pth_sc(select)(fd+1, &fds, NULL, NULL, &delay)) < 0 && errno == EINTR) ; + if (n < 0 && (errno == EINVAL || errno == EBADF)) + return pth_error(-1, errno); /* if filedescriptor is still not readable, let thread sleep until it is or the extra event occurs */ - if (n < 1) { + if (n == 0) { ev = pth_event(PTH_EVENT_FD|PTH_UNTIL_FD_READABLE|PTH_MODE_STATIC, &ev_key, fd); if (ev_extra != NULL) pth_event_concat(ev, ev_extra, NULL); @@ -1396,12 +1398,14 @@ delay.tv_usec = 0; while ((n = pth_sc(select)(fd+1, NULL, &fds, NULL, &delay)) < 0 && errno == EINTR) ; + if (n < 0 && (errno == EINVAL || errno == EBADF)) + return pth_error(-1, errno); rv = 0; for (;;) { /* if filedescriptor is still not writeable, let thread sleep until it is or event occurs */ - if (n < 1) { + if (n == 0) { ev = pth_event(PTH_EVENT_FD|PTH_UNTIL_FD_WRITEABLE|PTH_MODE_STATIC, &ev_key, fd); if (ev_extra != NULL) pth_event_concat(ev, ev_extra, NULL);