]> code.citadel.org Git - citadel.git/blobdiff - citadel/sysdep.c
* protect access to client_sock here too.
[citadel.git] / citadel / sysdep.c
index c39d85ba6092ad975302b98d149e6253df48cc7b..416fc7b897a1c70b840e5af4333c35f13b5edcf4 100644 (file)
@@ -1080,8 +1080,11 @@ do_select:       force_purge = 0;
                 */
                begin_critical_section(S_SESSION_TABLE);
                for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
-                       if ( (FD_ISSET(ptr->client_socket, &readfds))
-                          && (ptr->state == CON_IDLE) ) {
+                       int checkfd = ptr->client_socket;
+                       if ((checkfd != -1) && 
+                           (FD_ISSET(checkfd, &readfds)) &&
+                           (ptr->state == CON_IDLE) ) 
+                       {
                                ptr->input_waiting = 1;
                                if (!bind_me) {
                                        bind_me = ptr;  /* I choose you! */