Mercurial > hg > RemoteEditor > vim7
changeset 23:75fedd8da66f
*** empty log message ***
author | kono |
---|---|
date | Wed, 24 Sep 2008 18:11:41 +0900 |
parents | 09b6b4285677 |
children | e7d30a296a9b |
files | src/reditor.c |
diffstat | 1 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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;i<lnume+xtra;i++) { + for(i=lnum;i<lnume;i++) { // make INSERT_CMD for insert or changed lines if any cmd = make_cmd(REP_INSERT_CMD, cursn->sid, 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);