aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/listen.c16
-rw-r--r--src/os_compat.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/listen.c b/src/listen.c
index 78bb6ace1..423b54e9a 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -157,6 +157,22 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
#endif
BINDERROR();
}
+ } else if (param->value[0] == '/') {
+ size_t path_length;
+ struct sockaddr_un sun;
+
+ path_length = strlen(param->value);
+ if (path_length >= sizeof(sun.sun_path))
+ FATAL("unix socket path is too long\n");
+
+ sun.sun_family = AF_UNIX;
+ memcpy(sun.sun_path, param->value, path_length + 1);
+
+ addrp = (const struct sockaddr *)&sun;
+ addrlen = sizeof(sun);
+
+ if (establishListen(addrp, addrlen) < 0)
+ BINDERROR();
} else {
struct hostent *he;
DEBUG("binding to address for %s\n", param->value);
diff --git a/src/os_compat.h b/src/os_compat.h
index c6268d0d8..6409053c7 100644
--- a/src/os_compat.h
+++ b/src/os_compat.h
@@ -64,6 +64,7 @@
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/un.h>
#include <pwd.h>
#include <grp.h>
#include <limits.h>