Permalink
Browse files

changed from poll() to select() to work around bug in MacOSX.

Sometimes there's a packet waiting even though poll() says there isn't when
checking pcap_get_selectable() fd.

Thanks to dlorch at github
  • Loading branch information...
ThomasHabets committed Sep 6, 2010
1 parent 3bff117 commit b0a754550bb873b4fdb7049bfc394d38bfe3c72b
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/arping.c
@@ -921,12 +921,13 @@ ping_recv_unix(pcap_t *pcap,uint32_t packetwait, pcap_handler func)
/* try to wait for data */
{
struct pollfd p;
fd_set fds;
int r;
p.fd = fd;
p.events = POLLIN | POLLPRI;
r = poll(&p, 1, tv.tv_sec * 1000 + tv.tv_usec / 1000);
FD_ZERO(&fds);
FD_SET(fd, &fds);
r = select(fd + 1, &fds, NULL, NULL, &tv);
switch (r) {
case 0: /* timeout */
done = 1;

0 comments on commit b0a7545

Please sign in to comment.