commit 20eceebc77378727c836f846f8432d20c0ec4ac7 parent 2c93aa35f75d41aac2dd19bbb3e3935c88a3b80a Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Sat, 1 Jun 2019 22:51:50 +0300 Properly handle port detection if AF_UNIX socket is used on *BSD, macOS Diffstat:
| M | src/microhttpd/daemon.c | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -6124,6 +6124,14 @@ MHD_start_daemon_va (unsigned int flags, _("Failed to get listen port number (`struct sockaddr_storage` too small!?)\n")); #endif /* HAVE_MESSAGES */ } +#ifndef __linux__ + else if (0 == addrlen) + { + /* Many non-Linux-based platforms return zero addrlen + * for AF_UNIX sockets */ + daemon->port = 0; /* special value for UNIX domain sockets */ + } +#endif /* __linux__ */ #endif /* MHD_POSIX_SOCKETS */ else {