From c273462337cfa3203917fe1e5e00ca492d22edc9 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Mon, 28 Jan 2013 04:29:16 -0700 Subject: [PATCH] Fix "address.GetPort() != 0" assertion for helpers on FreeBSD (at least). The order (or set of?) #include files used by src/ssl/helper.cc (and probably by other helper source files) has changed recently, exposing a defines.h dependency on sys/socket.h where that system header is required to define AF_UNIX. With AF_UNIX incorrectly undefined, IPC_STREAM was set to IPC_TCP_SOCKET instead of IPC_UNIX_STREAM, and helpers that do not have a notion of a listening port, were trying to create communication sockets using TCP streams, triggering a "must have a port" assertion in comm_connect_addr() called from ipcCreate(). TODO: Moving IPC_* defines into an IPC-specific header file may be a better solution then exposing all defines.h users to sys/socket.h. --- src/defines.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/defines.h b/src/defines.h index 0fe2e0129a..3f288a1af3 100644 --- a/src/defines.h +++ b/src/defines.h @@ -175,6 +175,11 @@ #define IPC_UNIX_STREAM 4 #define IPC_UNIX_DGRAM 5 +/* required for AF_UNIX below to be defined [on FreeBSD] */ +#if HAVE_SYS_SOCKET_H +#include +#endif + #if HAVE_SOCKETPAIR && defined (AF_UNIX) #define IPC_STREAM IPC_UNIX_STREAM #define IPC_DGRAM IPC_UNIX_DGRAM -- 2.47.2