[PATCH] tests: commandhelper: Accept POLLNVAL on macOS
Roman Bolshakov
r.bolshakov at yadro.com
Wed Oct 7 18:32:16 UTC 2020
On Wed, Oct 07, 2020 at 06:57:21PM +0200, Andrea Bolognani wrote:
> On Wed, 2020-10-07 at 15:20 +0300, Roman Bolshakov wrote:
> > for (i = 0; i < numpollfds; i++) {
> > - if (fds[i].revents & (POLLIN | POLLHUP | POLLERR)) {
> > + if (fds[i].revents & (POLLIN | POLLHUP | POLLERR |
> > +# ifdef __APPLE__
> > + /*
> > + * poll() on /dev/null will return POLLNVAL
> > + */
> > + POLLNVAL)) {
> > +# else
> > + 0)) {
> > +# endif
>
> The fix seems legit, but having a preprocessor directive in the
> middle of a function call doesn't look great. Can you rewrite this
> along the lines of
>
> for (i = 0; i < numpollfds; i++) {
> short revents = POLLIN | POLLHUP | POLLERR;
>
> # ifdef __APPLE__
> /* On macOS, poll() on devices will return POLLNVAL */
> revents |= POLLNVAL;
> # endif
>
> if (fds[i].revents & revents) {
> /* ... */
> }
> }
>
> please?
>
Sure, this looks much better, thanks!
Thanks,
Roman
More information about the libvir-list
mailing list