|
From: | Paolo Bonzini |
Subject: | Re: [bug-gnulib] Updates to poll module |
Date: | Fri, 29 Sep 2006 08:43:36 +0200 |
User-agent: | Thunderbird 1.5.0.7 (Macintosh/20060909) |
+ 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.
How so? Only for EAGAIN and EINTR. If FIONREAD is supported, it will return EINVAL or something like that.
The idea is that we return POLLHUP or POLLERR, so having poll set an errno is misleading. If a function is allowed to modify errno arbitrarily (as long as it returns a positive value) I'm ok with removing this line.+ 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.
Ok to remove the errno = 0, and to leave as is the part you commented above? Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |