Index: src/OFSocket.m ================================================================== --- src/OFSocket.m +++ src/OFSocket.m @@ -549,12 +549,12 @@ if (length > sizeof(ret.sockaddr.un.sun_path)) @throw [OFOutOfRangeException exception]; memset(&ret, '\0', sizeof(ret)); ret.family = OFSocketAddressFamilyUNIX; - ret.length = (socklen_t)(sizeof(ret.sockaddr.un) - - (sizeof(ret.sockaddr.un.sun_path) - length)); + ret.length = (socklen_t) + (offsetof(struct sockaddr_un, sun_path) + length); #ifdef AF_UNIX ret.sockaddr.un.sun_family = AF_UNIX; #else ret.sockaddr.un.sun_family = AF_UNSPEC; Index: src/OFUNIXDatagramSocket.m ================================================================== --- src/OFUNIXDatagramSocket.m +++ src/OFUNIXDatagramSocket.m @@ -13,12 +13,10 @@ * file. */ #include "config.h" -#include - #ifdef HAVE_FCNTL_H # include #endif #import "OFUNIXDatagramSocket.h" Index: src/OFUNIXStreamSocket.m ================================================================== --- src/OFUNIXStreamSocket.m +++ src/OFUNIXStreamSocket.m @@ -13,12 +13,10 @@ * file. */ #include "config.h" -#include - #ifdef HAVE_FCNTL_H # include #endif #import "OFUNIXStreamSocket.h"