[haiku-development] poll(2) with nfds=0

  • From: Adrian Panasiuk <adek336@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 20 Mar 2009 18:16:35 +0100

#include <poll.h>
#include <stdio.h>

int main()
{
        int i = poll(NULL, 0, 2000);
        fprintf(stderr, "%d\n", i);
        return 0;
}

Haiku: immiedately prints -1
Linux: sleeps for 2 seconds and prints 0

This program passes fds = NULL but at the same time, nfds = 0; so
there isn't any actual null pointer dereference. The docs
http://www.opengroup.org/onlinepubs/007908799/xsh/poll.html don't seem
to cover this issue. Unless specifically configured not to, glib will
use this construct and expect it to follow the second behaviour.
Should glib be always configured to avoid this construct or should the
Haiku's implementation allow it?

Regards,
Adrian.

-- 
Czy ty orzeł, czy ty kawka? -wkrótce zdłabi kaszel, czkawka.
Śmierć szyję zaszyje.

Other related posts: