only expose struct tcphdr under _GNU_SOURCE
authorRich Felker <dalias@aerifal.cx>
Fri, 30 Aug 2013 21:06:17 +0000 (17:06 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 30 Aug 2013 21:06:17 +0000 (17:06 -0400)
the BSD and GNU versions of this structure differ, so exposing it in
the default _BSD_SOURCE profile is possibly problematic. both versions
could be simultaneously supported with anonymous unions if needed in
the future, but for now, just omitting it except under _GNU_SOURCE
should be safe.

include/netinet/tcp.h

index b8c793499ffac8424c793af28b260a95086d8d5a..8266f21daabe64854602e7dd3b18d59c04d47054 100644 (file)
 #define SOL_TCP 6
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <endian.h>
+#endif
 
+#ifdef _GNU_SOURCE
+#include <endian.h>
 struct tcphdr
 {
        u_int16_t source;