Fix non-blocking mode with bt-linux and bt-monitor-linux. Previously
when fd was set to non-blocking mode and pcap_dispatch() was called
from application, it returned -1 with errno EAGAIN breaking the api
contract.
Fix is to handle errnos EAGAIN and EWOULDBLOCK so that 0 is returned.
(cherry picked from commit
747ca9149a4158fafc4551550976cdb028916182)
} while ((ret == -1) && (errno == EINTR));
if (ret < 0) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ /* Nonblocking mode, no data */
+ return 0;
+ }
pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
errno, "Can't receive packet");
return -1;
} while ((ret == -1) && (errno == EINTR));
if (ret < 0) {
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ /* Nonblocking mode, no data */
+ return 0;
+ }
pcap_fmt_errmsg_for_errno(handle->errbuf, PCAP_ERRBUF_SIZE,
errno, "Can't receive packet");
return -1;