From f94f8fde7ec5c96e794772d75bc59b45cea54141 Mon Sep 17 00:00:00 2001 From: "S. Christoffer Eliesen" Date: Fri, 16 Oct 2015 11:42:20 +0200 Subject: [PATCH] sway/ipc: Support multiple users. --- sway/ipc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sway/ipc.c b/sway/ipc.c index 7a1d8a301..c1518c1f3 100644 --- a/sway/ipc.c +++ b/sway/ipc.c @@ -81,7 +81,11 @@ struct sockaddr_un *ipc_user_sockaddr(void) { assert(ipc_sockaddr != NULL); ipc_sockaddr->sun_family = AF_UNIX; - strcpy(ipc_sockaddr->sun_path, "/tmp/sway-ipc.sock"); + + int path_size = sizeof(ipc_sockaddr->sun_path); + + // Without logind: + assert(snprintf(ipc_sockaddr->sun_path, path_size, "/tmp/sway-ipc.%i.sock", getuid()) < path_size); return ipc_sockaddr; }