vol-fssync-server-socket-20090323
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 23 Mar 2009 22:42:48 +0000 (22:42 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 23 Mar 2009 22:42:48 +0000 (22:42 +0000)
LICENSE IPL10

GetHandler() sets up a fdset and returns the max socket fd
which is used with select().  Windows ignores the numfd param
(first param) of select() and therefore computing the max fd
value is meaningless.  We can avoid a number of casts by
not attempting to treat this value as osi_socket.

src/vol/fssync-server.c

index 786182d..079e1b3 100644 (file)
@@ -1652,14 +1652,17 @@ static void
 GetHandler(fd_set * fdsetp, int *maxfdp)
 {
     register int i;
-    register osi_socket maxfd = -1;
+    register int maxfd = -1;
     FD_ZERO(fdsetp);
     ObtainReadLock(&FSYNC_handler_lock);       /* just in case */
     for (i = 0; i < MAXHANDLERS; i++)
        if (HandlerFD[i] != -1) {
            FD_SET(HandlerFD[i], fdsetp);
-           if (maxfd < HandlerFD[i] || maxfd == (osi_socket)-1)
+#ifndef AFS_NT40_ENV
+            /* On Windows the nfds parameter to select() is ignored */
+           if (maxfd < HandlerFD[i] || maxfd == (int)-1)
                maxfd = HandlerFD[i];
+#endif /* AFS_NT40_ENV */
        }
     *maxfdp = maxfd;
     ReleaseReadLock(&FSYNC_handler_lock);      /* just in case */