> Maybe a way to improve my patches is testing is some data can be read from > the file descriptors and in this case continue the loop. something like: >
> if(i++ < 4) { > struct timeval tv = {0}; > FD_ZERO(&rfd); > FD_SET(cmdfd, &rfd); > FD_SET(xfd, &rfd); > if(select(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, &tv) > 0) > goto repeat; > } > i = 0; Uhmmm, this is not a good idea, because it is pretty similar than increase the input buffer by 4.