# HG changeset patch # User kono # Date 1222247501 -32400 # Node ID 75fedd8da66fd22e820589d9366139b9c71bb032 # Parent 09b6b4285677cc9cbae1ab2a6c242d254a283a80 *** empty log message *** diff -r 09b6b4285677 -r 75fedd8da66f src/reditor.c --- a/src/reditor.c Tue Sep 16 19:21:03 2008 +0900 +++ b/src/reditor.c Wed Sep 24 18:11:41 2008 +0900 @@ -942,7 +942,7 @@ } else if (xtra>0) { // append case - for(i=lnum;isid, rep->eid, rep->seqno++, i+1, get_memline_wrp(cursn->buf, i+1)); add_cmd_to_list(&(cursn->new_cmdlist), cmd); @@ -1322,6 +1322,9 @@ int max_fds = MAX_FDS; struct timeval tv; + struct timeval zerotime; + zerotime.tv_sec = 0; + zerotime.tv_usec = 0; if (fd < 0) return(FALSE); @@ -1337,8 +1340,27 @@ max_fds = rep_fd_set(&rfds_p, &efds_p, max_fds); if ((sk = select(max_fds+1, &rfds_p, NULL, &efds_p, &tv)) < 0) { - e_msg_wrp("rep_select(): ERROR"); - return(FALSE); + if (errno == EBADF){ + int i; + for(i = 0;i < max_fds;i++){ + fd_set suspect; + FD_ZERO(&suspect); + if (FD_ISSET(i, &rfds_p)){ + FD_SET(i, &suspect); + if (select(max_fds, &suspect, NULL, NULL, &zerotime) == FAIL){ + FD_CLR(i, &rfds_p); + // we have to something to prevent to write to this + // port... + return(TRUE); + } + FD_CLR(i, &suspect); + } + } + } else { + e_msg_wrp("rep_select(): ERROR"); + return(FALSE); + } + } rep_fd_check(fd, &rfds_p, &efds_p);