diff options
author | epochqwert <epoch@hacking.allowed.org> | 2015-06-21 23:28:15 -0500 |
---|---|---|
committer | epochqwert <epoch@hacking.allowed.org> | 2015-06-21 23:28:15 -0500 |
commit | 66e6d359ac08684ed63541548ac7fdb7309abf11 (patch) | |
tree | c45b78c966a2ed250da714e4045cb07725ce599c | |
parent | 985da79c2cb6961f54bf13abdb7758ec67d710b0 (diff) | |
download | libirc-66e6d359ac08684ed63541548ac7fdb7309abf11.tar.gz libirc-66e6d359ac08684ed63541548ac7fdb7309abf11.zip |
added a check that there was at least ONE fd in the fd list passed to runem
-rw-r--r-- | libirc.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -92,6 +92,7 @@ int runem(int *fds,void (*line_handler)(),void (*extra_handler)()) { int blsize=CHUNK; int bllen=0; char buffers[fdl][CHUNK];//THIS IS *NOT* NULL TERMINATED. + if(fds[0] == -1) return 0; FD_ZERO(&master); FD_ZERO(&readfs); for(i=0;fds[i] != -1;i++) { @@ -108,7 +109,6 @@ int runem(int *fds,void (*line_handler)(),void (*extra_handler)()) { if((j=select(fdmax+1,&readfs,0,0,&timeout)) == -1 ) return perror("select"),1; 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. - printf("getting there.\n"); for(i=0;fds[i] != -1;i++) { if(!FD_ISSET(fds[i],&readfs)) continue; if((n=recv(fds[i],buffers[i],CHUNK,0)) <= 0) return (perror("recv"),2); @@ -123,8 +123,6 @@ int runem(int *fds,void (*line_handler)(),void (*extra_handler)()) { } memcpy(backlogs[i]+bllen,buffers[i],n); bllen+=n; - -//HERE EPOCH while((t=strstr(backlogs[i],"\r\n"))) { line=backlogs[i]; if(!strncmp(line,"PING",4)) { |