OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_util.c versions 1.21 and 1.22
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_util.c 1.21 -> 1.22

--- pth_util.c   2002/01/27 13:15:28     1.21
+++ pth_util.c   2002/10/24 09:07:51     1.22
@@ -92,13 +92,14 @@
 }
 
 /* check whether a file-descriptor is valid */
-#if cpp
-#if !defined(FD_SETSIZE)
-#define FD_SETSIZE 1024
-#endif
-#define pth_util_fd_valid(fd) \
-    ((fd) >= 0 && (fd) <= (FD_SETSIZE-1))
-#endif
+intern int pth_util_fd_valid(int fd)
+{
+    if (fd < 0 || fd >= FD_SETSIZE)
+        return FALSE;
+    if (fcntl(fd, F_GETFL) == -1 && errno == EBADF)
+        return FALSE;
+    return TRUE;
+}
 
 /* merge input fd set into output fds */
 intern void pth_util_fds_merge(int nfd,

CVSTrac 2.0.1