aboutsummaryrefslogtreecommitdiff
path: root/ftmacros.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-11-24 11:22:56 -0800
committerGuy Harris <guy@alum.mit.edu>2017-11-24 11:22:56 -0800
commit919869b52efa69422160305931554a952520a1b0 (patch)
treeeaa7e7cf3d7af62485677bb0a7cbd735fa4cf1ef /ftmacros.h
parent55540232b39f5f7cc5240ebdb971f51697566a52 (diff)
downloadlibpcap-919869b52efa69422160305931554a952520a1b0.tar.gz
Fix build with some versions of GNU libc.
Diffstat (limited to 'ftmacros.h')
-rw-r--r--ftmacros.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/ftmacros.h b/ftmacros.h
index 8e319493..2d8e20fa 100644
--- a/ftmacros.h
+++ b/ftmacros.h
@@ -43,9 +43,6 @@
* to make non-POSIX APIs that we use unavailable.
* XXX - is there no portable way to say "please pollute the
* namespace to the maximum extent possible"?
- *
- * We also want to force crypt() to be declared on systems that use
- * GNU libc, such as most Linux distributions.
*/
#if defined(sun) || defined(__sun)
#define __EXTENSIONS__
@@ -59,7 +56,22 @@
#elif defined(_hpux) || defined(hpux) || defined(__hpux)
#define _REENTRANT
#elif defined(__linux__) || defined(linux) || defined(__linux)
- #define _GNU_SOURCE
+ /*
+ * We can't turn _GNU_SOURCE on because some versions of GNU Libc
+ * will give the GNU version of strerror_r(), which returns a
+ * string pointer and doesn't necessarily fill in the buffer,
+ * rather than the standard version of strerror_r(), which
+ * returns 0 or an errno and always fills in the buffer. We
+ * require both of the latter behaviors.
+ *
+ * So we try turning everything else on that we can. This includes
+ * defining _XOPEN_SOURCE as 600, because we want to force crypt()
+ * to be declared on systems that use GNU libc, such as most Linux
+ * distributions.
+ */
+ #define _POSIX_C_SOURCE 200809L
+ #define _XOPEN_SOURCE 600
+ #define _BSD_SOURCE
#endif
#endif