summaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-10-16 13:04:46 +0200
committerLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-10-16 13:07:50 +0200
commit7cb073203038983ac641770ea8cc0db222ca0df7 (patch)
tree664b388ece4c6839961cb6d8a965e018fa283aab /sway
parentsway/ipc: Fix whitespace. (diff)
downloadsway-7cb073203038983ac641770ea8cc0db222ca0df7.tar.gz
sway-7cb073203038983ac641770ea8cc0db222ca0df7.tar.zst
sway-7cb073203038983ac641770ea8cc0db222ca0df7.zip
sway/ipc: ipc_user_sockaddr: Use sway_assert instead of assert.
Diffstat (limited to 'sway')
-rw-r--r--sway/ipc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index 5599cdf0..dba2acb3 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -82,14 +82,20 @@ void ipc_terminate(void) {
82 82
83struct sockaddr_un *ipc_user_sockaddr(void) { 83struct sockaddr_un *ipc_user_sockaddr(void) {
84 struct sockaddr_un *ipc_sockaddr = malloc(sizeof(struct sockaddr_un)); 84 struct sockaddr_un *ipc_sockaddr = malloc(sizeof(struct sockaddr_un));
85 assert(ipc_sockaddr != NULL); 85 if (!sway_assert(ipc_sockaddr != NULL, "can't malloc ipc_sockaddr")) {
86 return NULL;
87 }
86 88
87 ipc_sockaddr->sun_family = AF_UNIX; 89 ipc_sockaddr->sun_family = AF_UNIX;
88 90
89 int path_size = sizeof(ipc_sockaddr->sun_path); 91 int path_size = sizeof(ipc_sockaddr->sun_path);
90 92
91 // Without logind: 93 // Without logind:
92 assert(snprintf(ipc_sockaddr->sun_path, path_size, "/tmp/sway-ipc.%i.sock", getuid()) < path_size); 94 int allocating_path_size = snprintf(ipc_sockaddr->sun_path, path_size, "/tmp/sway-ipc.%i.sock", getuid());
95
96 if (!sway_assert(allocating_path_size < path_size, "socket path won't fit into ipc_sockaddr->sun_path")) {
97 return NULL;
98 }
93 99
94 return ipc_sockaddr; 100 return ipc_sockaddr;
95} 101}