From: François Revol Date: Fri, 8 Jul 2022 21:24:43 +0000 (+0200) Subject: Fix build on Haiku X-Git-Tag: libpcap-1.10.2~119 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/23159ec45ef306eab8ef1caaa4c12d17dac2f457?ds=inline Fix build on Haiku This fixes #1114. C++11 forbids declaring types inside typeof and offsetof, so we drop the macro call and declare the struct separately for the only use of the call. (cherry picked from commit d0ba0d53f2dad05d7eb3ba12f508eea3464a855f) --- diff --git a/pcap-haiku.cpp b/pcap-haiku.cpp index 8b0009c5..4606ca0e 100644 --- a/pcap-haiku.cpp +++ b/pcap-haiku.cpp @@ -249,7 +249,11 @@ pcap_create_interface(const char *device, char *errorBuffer) return NULL; } - pcap_t* handle = PCAP_CREATE_COMMON(errorBuffer, struct pcap_haiku); + struct wrapper_struct { pcap_t __common; struct pcap_haiku __private; }; + pcap_t* handle = pcap_create_common(errorBuffer, + sizeof (struct wrapper_struct), + offsetof (struct wrapper_struct, __private)); + if (handle == NULL) { snprintf(errorBuffer, PCAP_ERRBUF_SIZE, "malloc: %s", strerror(errno)); close(socket);