Revert the accidental commit to list.c, and commit the correct file (s_bsd.c).
[ircu2.10.12-pk.git] / ircd / s_bsd.c
index 63e9081c51da376193f3a01b9884c8e76b2da4be..2d8fb5ba39594cbe85f399c2d31a853a9fbe9224 100644 (file)
@@ -862,6 +862,11 @@ static void client_sock_callback(struct Event* ev)
   case ET_ERROR: /* an error occurred */
     fallback = cli_info(cptr);
     cli_error(cptr) = ev_data(ev);
+    /* If the OS told us we have a bad file descriptor, we should
+     * record that for future reference.
+     */
+    if (cli_error(cptr) == EBADF)
+      cli_fd(cptr) = -1;
     if (s_state(&(con_socket(con))) == SS_CONNECTING) {
       completed_connection(cptr);
       /* for some reason, the os_get_sockerr() in completed_connect()