Re: [PATCH] tests: commandhelper: Accept POLLNVAL on macOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux