Paolo Bonzini wrote: > + do > + r = ioctl (pfd[i].fd, FIONREAD, &avail); > + while (r == -1 && (errno == EAGAIN || errno == EINTR)); > + if (avail < 0) > + avail = 0;
When ioctl returns -1, maybe because FIONREAD is not supported or so, this loops endlessly. > + errno = 0; What's the purpose of that? If recv() needs errro to be 0 upon entry, this statement should come before the recv() call. It cannot be needed for the caller, since at this point it is guaranteed that the function returns with "return rc;" which is positive. Bruno