From 900ef43ea438815b7d6fac5fb9b194ea55454d20 Mon Sep 17 00:00:00 2001 From: Yeonjun Lim Date: Sun, 10 Apr 2016 13:19:16 +0900 Subject: [PATCH] Support for abstract socket --- lib/libwebsockets.c | 3 +++ lib/libwebsockets.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index e88dbdd65..81ad005e0 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -1502,6 +1502,9 @@ lws_socket_bind(struct lws_context *context, int sockfd, int port, return -1; } strcpy(serv_unix.sun_path, iface); + if (serv_unix.sun_path[0] == '@') { + serv_unix.sun_path[0] = '\0'; + } } else #endif #ifdef LWS_USE_IPV6 diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index e3267a28a..e4b95d349 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -1375,7 +1375,9 @@ struct lws_protocol_vhost_options { * @iface: NULL to bind the listen socket to all interfaces, or the * interface name, eg, "eth2" * If options specifies LWS_SERVER_OPTION_UNIX_SOCK, this member is - * the pathname of a UNIX domain socket. + * the pathname of a UNIX domain socket. you can use the UNIX domain + * sockets in abstract namespace, by prepending an @ symbole to the + * socket name. * @protocols: Array of structures listing supported protocols and a protocol- * specific callback for each one. The list is ended with an * entry that has a NULL callback pointer.