OSSP CVS Repository

ossp - Check-in [2664]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2664
Date: 2002-Oct-25 13:53:28 (local)
2002-Oct-25 11:53:28 (UTC)
User:rse
Branch:
Comment: More POSIX compliance for pth_select() in case of invalid timeout values and invalid filedescriptors.
Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.580 -> 1.581     4 inserted, 0 deleted
ossp-pkg/pth/pth_high.c      1.91 -> 1.92     9 inserted, 0 deleted

ossp-pkg/pth/ChangeLog 1.580 -> 1.581

--- 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.


ossp-pkg/pth/pth_high.c 1.91 -> 1.92

--- 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;

CVSTrac 2.0.1