From 143bd830b55d304d914e7cf6f9d75c3de306e9ab Mon Sep 17 00:00:00 2001 From: Boris Barbulovski Date: Fri, 2 Aug 2019 05:08:03 +0200 Subject: [PATCH] Add unix/linux abstract socket address feature. Add possibility for abstract socket address, so that socket will not exist on filesystem. In order to create abstract socket address simply use name that will start with `*`. `*tmp/sock` for ex. --- libfcgi/os_unix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libfcgi/os_unix.c b/libfcgi/os_unix.c index 0724e67..4a583dd 100755 --- a/libfcgi/os_unix.c +++ b/libfcgi/os_unix.c @@ -261,6 +261,9 @@ static int OS_BuildSockAddrUn(const char *bindPath, memset((char *) servAddrPtr, 0, sizeof(*servAddrPtr)); servAddrPtr->sun_family = AF_UNIX; memcpy(servAddrPtr->sun_path, bindPath, bindPathLen); + if (servAddrPtr->sun_path[0] == '*') { // abstract socket address + servAddrPtr->sun_path[0] = '\0'; + } #ifdef HAVE_SOCKADDR_UN_SUN_LEN /* 4.3BSD Reno and later: BSDI, DEC */ *servAddrLen = sizeof(servAddrPtr->sun_len) + sizeof(servAddrPtr->sun_family)