libreplace: Bug 8107, Fix poll replacement to become a msleep replacement
[metze/samba/wip.git] / lib / replace / poll.c
index e41548dd39f5b9509def73e412ec0ef8f134a50c..27876bb06706721b2db7682ab7c5f7fcc9df6641 100644 (file)
 
 #include "replace.h"
 #include "system/select.h"
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_IOCTL
+#include <sys/ioctl.h>
+#endif
 
 
 int rep_poll(struct pollfd *fds, nfds_t nfds, int timeout)
@@ -40,7 +46,7 @@ int rep_poll(struct pollfd *fds, nfds_t nfds, int timeout)
        int rc;
        nfds_t i;
 
-       if (fds == NULL) {
+       if ((fds == NULL) && (nfds != 0)) {
                errno = EFAULT;
                return -1;
        }