From 730ce301477d9d5c9367756bad840eb4504e0257 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 2 Dec 2013 05:54:00 +0100 Subject: [PATCH] Fix compile on FreeBSD. -D_XOPEN_SOURCE=600 is necessary for struct sockaddr_in6. --- configure.ac | 2 +- src/connection.c | 1 + src/log.c | 2 +- src/tlsproxy.c | 5 +++-- src/tlsproxy.h | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 1d3592a..24f2c1f 100644 --- a/configure.ac +++ b/configure.ac @@ -36,7 +36,7 @@ CC="$PTHREAD_CC" if test "x$GCC" = xyes; then CFLAGS="-std=c89 -pedantic -Wall -Wextra -Werror $CFLAGS" CFLAGS="-Wno-error=int-to-pointer-cast $CFLAGS" - CPPFLAGS="-D_XOPEN_SOURCE=500 $CPPFLAGS" + CPPFLAGS="-D_XOPEN_SOURCE=600 $CPPFLAGS" # Additional hardening flags. CFLAGS="-fPIE -fstack-protector-all -Wformat -Werror=format-security $CFLAGS" CPPFLAGS="-D_FORTIFY_SOURCE=2 $CPPFLAGS" diff --git a/src/connection.c b/src/connection.c index 793e468..ad7298a 100644 --- a/src/connection.c +++ b/src/connection.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/src/log.c b/src/log.c index 402e82d..678b568 100644 --- a/src/log.c +++ b/src/log.c @@ -52,7 +52,7 @@ void log_message(int level, const char *file, int line, const char *format, ...) #ifdef DEBUG fprintf(stderr, "%-12s:%-4d ", file, line); #endif - fprintf(stderr, "[%s] [%d] ", level_string, (int)pthread_self()); + fprintf(stderr, "[%s] [%ld] ", level_string, (long)pthread_self()); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 160a236..fa57064 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -26,13 +26,14 @@ #include #include #include +#include +#include #include #include +#include #include #include #include -#include -#include #if GNUTLS_VERSION_NUMBER <= 0x020b00 /* Necessary for GnuTLS when used with threads. */ diff --git a/src/tlsproxy.h b/src/tlsproxy.h index 4664428..15c5a51 100644 --- a/src/tlsproxy.h +++ b/src/tlsproxy.h @@ -25,6 +25,7 @@ #include #include #include +#include #include -- 2.45.2