From: José Bollo Date: Fri, 14 Apr 2017 13:36:53 +0000 (+0200) Subject: allow abstract unix sockets X-Git-Tag: dab_3.99.1~50 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=9e8b1e1d13cd9c382769014d43d6f2604b396968;p=src%2Fapp-framework-binder.git allow abstract unix sockets unix sockets named "unix:@something" are now treated as abstract sockets. Change-Id: Ieb2bb9dd1c7b420b9e3fae81590ef49c32f63802 Signed-off-by: José Bollo --- diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c index 56682ddc..ba9a18a9 100644 --- a/src/afb-api-ws.c +++ b/src/afb-api-ws.c @@ -281,7 +281,7 @@ static int api_ws_socket_unix(const char *path, int server) return -1; } - if (server) + if (server && path[0] != '@') unlink(path); fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -291,6 +291,8 @@ static int api_ws_socket_unix(const char *path, int server) memset(&addr, 0, sizeof addr); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, path); + if (addr.sun_path[0] == '@') + addr.sun_path[0] = 0; /* implement abstract sockets */ if (server) { rc = bind(fd, (struct sockaddr *) &addr, (socklen_t)(sizeof addr)); } else {