diff options
author | Guy Harris <gharris@sonic.net> | 2022-03-08 15:18:24 -0800 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2022-03-08 15:18:24 -0800 |
commit | f6fb59b11d20222d4648cdceeaadf6ce971a7a9a (patch) | |
tree | 82d4be40231a93047587a9cd52777b77528e188d /pcap-bt-linux.c | |
parent | cc9e70b80e0a33130fcb24fbab13a40666976d7f (diff) | |
parent | e75cc82c46e0f1208fbac03530da6a30976c7fd6 (diff) |
Merge branch 'master' into pcap-options
Diffstat (limited to 'pcap-bt-linux.c')
-rw-r--r-- | pcap-bt-linux.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pcap-bt-linux.c b/pcap-bt-linux.c index 2969ff8d..37c80565 100644 --- a/pcap-bt-linux.c +++ b/pcap-bt-linux.c @@ -98,6 +98,14 @@ bt_findalldevs(pcap_if_list_t *devlistp, char *err_str) goto done; } + /* + * Zero the complete header, which is larger than dev_num because of tail + * padding, to silence Valgrind, which overshoots validating that dev_num + * has been set. + * https://github.com/the-tcpdump-group/libpcap/issues/1083 + * https://bugs.kde.org/show_bug.cgi?id=448464 + */ + memset(dev_list, 0, sizeof(*dev_list)); dev_list->dev_num = HCI_MAX_DEV; if (ioctl(sock, HCIGETDEVLIST, (void *) dev_list) < 0) @@ -341,6 +349,10 @@ bt_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char } 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; |