From 9c15fbe768917dbc724afc58c84f4d4cf455b75e Mon Sep 17 00:00:00 2001 From: epochqwert Date: Mon, 7 Dec 2015 02:34:50 -0600 Subject: made a select fail not kill the whole program --- libirc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libirc.c b/libirc.c index 13e3458..84fe37b 100644 --- a/libirc.c +++ b/libirc.c @@ -142,7 +142,11 @@ int runem(int *fds,void (*line_handler)(),void (*extra_handler)()) { readfs=master; timeout.tv_sec=0; timeout.tv_usec=1000; - if((j=select(fdmax+1,&readfs,0,0,&timeout)) == -1 ) return perror("select"),1; + if((j=select(fdmax+1,&readfs,0,0,&timeout)) == -1 ) { + //let's just ignore it for now. :> + //return perror("select"),1; + continue; + } for(i=0;fds[i] != -1;i++) if(extra_handler) extra_handler(fds[i]); if(j == 0) continue;//don't bother to loop over them. for(i=0;fds[i] != -1;i++) { @@ -160,8 +164,8 @@ int runem(int *fds,void (*line_handler)(),void (*extra_handler)()) { bllen[i]+=n; //manually loop? -//works for IRC that uses \r\n. need to make it work for just \n too? /* +//works for IRC that uses \r\n. need to make it work for just \n too? while((t=memstr(backlogs[i],"\r\n",bllen[i]))) {//no. backlogs aren't nulled. line=backlogs[i]; if((t-backlogs[i]) >=4 && !strncmp(line,"PING",4)) { @@ -176,6 +180,7 @@ int runem(int *fds,void (*line_handler)(),void (*extra_handler)()) { if(bllen[i] <= 0) bllen[i]=0; else memmove(backlogs[i],(t+2),bllen[i]); } + */ while((t=memchr(backlogs[i],'\n',bllen[i]))) {//no. backlogs aren't nulled. line=backlogs[i]; -- cgit v1.2.3