From e4e9cd8cb934121d17d3d472b1846ffad6619dad Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Tue, 18 Nov 2008 09:21:27 +0000 Subject: [PATCH] libasyncio: (tomj) document the magic behind MegaAddr --- asyncio/async_socket.cpp | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/asyncio/async_socket.cpp b/asyncio/async_socket.cpp index 468ceb3..34e04ef 100644 --- a/asyncio/async_socket.cpp +++ b/asyncio/async_socket.cpp @@ -27,6 +27,16 @@ namespace struct sockaddr_un dummy_un; +/** + Struct for holding sockaddr. + + It's called "MegaAddr" because we use a trick to extend the historical UNIX domain socket + path length of 108 bytes to PATH_MAX by declaring a large enough buffer + at the end of the union. + + This works as long as the POSIX functions don't verify the buffer length. + For glibc on linux this is true. +*/ union MegaAddr { struct sockaddr m_addr; struct sockaddr_in m_addr_in; -- 1.7.1