aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-13 08:17:35 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-13 08:17:35 -0500
commit1011957465dd9a6e6d29ecb4dc07f0cb8af50ea5 (patch)
tree6c6c7fbb0caa7333e3bf80de6a00c346000cb0c2 /sway
parentRevert "Try ~/.i3/config earlier than /etc/sway/config" (diff)
parentMerge pull request #225 from sce/logind_socket_path (diff)
downloadsway-1011957465dd9a6e6d29ecb4dc07f0cb8af50ea5.tar.gz
sway-1011957465dd9a6e6d29ecb4dc07f0cb8af50ea5.tar.zst
sway-1011957465dd9a6e6d29ecb4dc07f0cb8af50ea5.zip
Merge branch 'master' of github.com:SirCmpwn/sway
Diffstat (limited to 'sway')
-rw-r--r--sway/ipc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index 8935147d..d13eb87f 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -94,14 +94,15 @@ struct sockaddr_un *ipc_user_sockaddr(void) {
94 } 94 }
95 95
96 ipc_sockaddr->sun_family = AF_UNIX; 96 ipc_sockaddr->sun_family = AF_UNIX;
97
98 int path_size = sizeof(ipc_sockaddr->sun_path); 97 int path_size = sizeof(ipc_sockaddr->sun_path);
99 98
100 // Without logind: 99 // Env var typically set by logind, e.g. "/run/user/<user-id>"
101 int allocating_path_size = snprintf(ipc_sockaddr->sun_path, path_size, 100 const char *dir = getenv("XDG_RUNTIME_DIR");
102 "/tmp/sway-ipc.%i.%i.sock", getuid(), getpid()); 101 if (!dir) {
103 102 dir = "/tmp";
104 if (allocating_path_size >= path_size) { 103 }
104 if (path_size <= snprintf(ipc_sockaddr->sun_path, path_size,
105 "%s/sway-ipc.%i.%i.sock", dir, getuid(), getpid())) {
105 sway_abort("socket path won't fit into ipc_sockaddr->sun_path"); 106 sway_abort("socket path won't fit into ipc_sockaddr->sun_path");
106 } 107 }
107 108