summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2017-09-15 18:21:32 +0100
committerFrediano Ziglio <fziglio@redhat.com>2020-03-03 16:18:01 +0000
commit1bf9d22cf2504a75efc8e6518b76f8729e3153b0 (patch)
tree4f7587bfae8bc5d3b2fff300d8246626c65c4742
parenta6ccd2a3094b3910ba9f5405162b35d9340fe1a4 (diff)
Support abstract Unix sockets
Allows to specify abstract Unix sockets addresses. These Unix sockets are supported on Linux and allows to not have file system names. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Kevin Pouget <kpouget@redhat.com>
-rw-r--r--server/reds.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/reds.c b/server/reds.c
index df1fb469..34c107a6 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2588,8 +2588,12 @@ static int reds_init_socket(const char *addr, int portnr, int family)
local.sun_family = AF_UNIX;
g_strlcpy(local.sun_path, addr, sizeof(local.sun_path));
- unlink(local.sun_path);
len = SUN_LEN(&local);
+ if (local.sun_path[0] == '@') {
+ local.sun_path[0] = 0;
+ } else {
+ unlink(local.sun_path);
+ }
if (bind(slisten, (struct sockaddr *)&local, len) == -1) {
perror("bind");
socket_close(slisten);