summaryrefslogtreecommitdiff
path: root/pcap-usb-linux.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-07-01 02:15:40 -0700
committerGuy Harris <gharris@sonic.net>2020-07-01 02:15:40 -0700
commit5a68762e8b0cae345e4f42ff2dc4eee9ce32329d (patch)
tree86aa6ef65f73ee37f2ac80031ae2f81bb2d3c457 /pcap-usb-linux.c
parent89b721fb41bf47b21662752221a4dd13a464da99 (diff)
downloadlibpcap-5a68762e8b0cae345e4f42ff2dc4eee9ce32329d.tar.gz
Handle the pcap_t+private data in a fashion that makes fewer assumptions.
The sizeof operator and alignof macro can be given a type "name" that's anonymous, e.g. sizeof(struct { int a; char *b; }). Have pcap_create_common() and pcap_open_offline_common() take, as arguments, the total size of a structure containing both the pcap_t and the private data as members, and the offset of the private data in that structure, and define macros that calculate those given, as an argument, the data type of the private data. This avoids making assumptions about the alignment of those two items within the structure; that *might* fix GitHub issue #940 if the issue is that the ARM compiler being used does 16-byte alignment of the private structure, rather than the 8-byte alignment we were wiring in.
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r--pcap-usb-linux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c
index ddab03a9..98d22de4 100644
--- a/pcap-usb-linux.c
+++ b/pcap-usb-linux.c
@@ -617,7 +617,7 @@ usb_create(const char *device, char *ebuf, int *is_ours)
/* OK, it's probably ours. */
*is_ours = 1;
- p = pcap_create_common(ebuf, sizeof (struct pcap_usb_linux));
+ p = PCAP_CREATE_COMMON(ebuf, struct pcap_usb_linux);
if (p == NULL)
return (NULL);