From e17fa89d8fa8aa25d6655fe1a2f56da63b3d370d Mon Sep 17 00:00:00 2001 From: Thierry Thomas Date: Mon, 26 Sep 2016 04:32:17 +0200 Subject: [PATCH] Update misc_tools.c (#408) * Update misc_tools.c Fix build on FreeBSD with clang. Without this patch, compilation fails with these messages: CC misc_tools.o /usr/ports/net-im/toxic/work/toxic-0.7.1/src/misc_tools.c:479:24: error: variable has incomplete type 'struct sockaddr_in' struct sockaddr_in s_addr; ^ /usr/ports/net-im/toxic/work/toxic-0.7.1/src/misc_tools.c:479:12: note: forward declaration of 'struct sockaddr_in' struct sockaddr_in s_addr; ^ /usr/ports/net-im/toxic/work/toxic-0.7.1/src/misc_tools.c:480:22: error: use of undeclared identifier 'AF_INET' return inet_pton(AF_INET, address, &(s_addr.sin_addr)) != 0; ^ 2 errors generated. * Fix build on FreeBSD with clang Without this patch, compilation fails with these messages: CC misc_tools.o /usr/ports/net-im/toxic/work/toxic-0.7.1/src/misc_tools.c:479:24: error: variable has incomplete type 'struct sockaddr_in' struct sockaddr_in s_addr; ^ /usr/ports/net-im/toxic/work/toxic-0.7.1/src/misc_tools.c:479:12: note: forward declaration of 'struct sockaddr_in' struct sockaddr_in s_addr; ^ /usr/ports/net-im/toxic/work/toxic-0.7.1/src/misc_tools.c:480:22: error: use of undeclared identifier 'AF_INET' return inet_pton(AF_INET, address, &(s_addr.sin_addr)) != 0; ^ 2 errors generated. --- src/misc_tools.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/misc_tools.c b/src/misc_tools.c index a07a863..1eda579 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -26,9 +26,13 @@ #include #include #include - -#include +#if defined(__FreeBSD__) +#include +#include +#else #include +#endif +#include #include "toxic.h" #include "windows.h"