aboutsummaryrefslogtreecommitdiff
path: root/pcap-new.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-03-19 01:41:03 -0700
committerGuy Harris <guy@alum.mit.edu>2019-03-19 01:41:54 -0700
commit5710ec495d98d89d3a7c0722786081fee908b43e (patch)
tree2dedd8017abe008f5455e1c3b4e87e81f84af740 /pcap-new.c
parentbaffaf4364f5595fa86d4a67f687ce293ef1aca3 (diff)
Make sure asprintf() is declared if it's present.
GNU libc is a pain. If you don't define _GNU_SOURCE, it doesn't declare asprintf(). If you *do* define _GNU_SOURCE, the strerror_r() it declares isn't POSIX-compliant. We use asprintf() if present, so we need it to be declared; define _GNU_SOURCE in ftmacros.h. At configuration time, if we have strerror_r(), check whether it's GNU-style or POSIX-style, and define different #defines for those two cases. Handle GNU-style strerror_r() and POSIX-style strerror_r() differently in pcap_fmt_errmsg_for_errno(). Make sure everything that uses asprintf() includes ftmacros.h before including stdio.h.
Diffstat (limited to 'pcap-new.c')
-rw-r--r--pcap-new.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pcap-new.c b/pcap-new.c
index 6b333e4e..2cce433c 100644
--- a/pcap-new.c
+++ b/pcap-new.c
@@ -35,6 +35,8 @@
#include <config.h>
#endif
+#include "ftmacros.h"
+
/*
* sockutils.h may include <crtdbg.h> on Windows, and pcap-int.h will
* include portability.h, and portability.h, on Windows, expects that