Define _GNU_SOURCE to get the ucred structure.
authorAndre Noll <maan@systemlinux.org>
Sat, 28 Feb 2009 21:39:50 +0000 (22:39 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 28 Feb 2009 21:39:50 +0000 (22:39 +0100)
This is needed for glibc >= 2.8.

configure.ac
net.c

index dca492037eb7510b451d03ceb942e51f1857f0f0..f783db789781bfc5e40fc48699c8d670fc0d99e3 100644 (file)
@@ -223,6 +223,7 @@ AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
 ########################################################################### ucred
 AC_MSG_CHECKING(for struct ucred)
 AC_TRY_LINK([
+       #define _GNU_SOURCE
        #include <sys/types.h>
        #include <sys/socket.h>
 ],[
diff --git a/net.c b/net.c
index 2a3fc72be0ad446fa101dcbd9459107fb49f50dd..88b3e3cc8aee0b2fadfd7783c763b062b8ac0d24 100644 (file)
--- a/net.c
+++ b/net.c
@@ -6,6 +6,12 @@
 
 /** \file net.c Networking-related helper functions. */
 
+/*
+ * Since glibc 2.8, the _GNU_SOURCE feature test macro must be defined in order
+ * to obtain the definition of the ucred structure.
+ */
+#define _GNU_SOURCE
+
 #include <netdb.h>
 
 /* At least NetBSD needs these. */