Index: ossp-pkg/pth/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/pth/ChangeLog,v rcsdiff -q -kk '-r1.580' '-r1.581' -u '/v/ossp/cvs/ossp-pkg/pth/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/10/24 15:21:13 1.580 +++ ChangeLog 2002/10/25 11:53:28 1.581 @@ -21,6 +21,10 @@ Changes between 1.4.1 and 1.5.0 (27-Jan-2002 to xx-Oct-2002) + *) More POSIX compliance for pth_select() in case of invalid + timeout values and invalid filedescriptors. + [Ralf S. Engelschall] + *) Internally switch from "errno_shield {...}" to "pth_shield {...}" and from "return_errno(..)" to "return pth_error(...)" in order to make the internal error handling a little bit more consistent. Index: ossp-pkg/pth/pth_high.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_high.c,v rcsdiff -q -kk '-r1.91' '-r1.92' -u '/v/ossp/cvs/ossp-pkg/pth/pth_high.c,v' 2>/dev/null --- pth_high.c 2002/10/24 15:21:13 1.91 +++ pth_high.c 2002/10/25 11:53:28 1.92 @@ -300,6 +300,13 @@ /* POSIX compliance */ if (nfd < 0 || nfd > FD_SETSIZE) return pth_error(-1, EINVAL); + if (timeout != NULL) { + if ( timeout->tv_sec < 0 + || timeout->tv_sec > 100000000 /* about 3 years */ + || timeout->tv_usec < 0 + || timeout->tv_usec >= 1000000 /* a full second */) + return pth_error(-1, EINVAL); + } /* first deal with the special situation of a plain microsecond delay */ if (nfd == 0 && rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL) { @@ -371,6 +378,8 @@ return 0; } } + if (rc < 0 && errno == EBADF) + return pth_error(-1, EBADF); /* suspend current thread until one fd is ready or the timeout occurred */ rc = -1;