
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? -- Andrea Bolognani / Red Hat / Virtualization