aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-10-16 13:21:34 +0200
committerLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-10-16 13:23:08 +0200
commit783290e81a5947865c00a5af30c1ba5e2ecd1052 (patch)
treeb94de69f9b0b47f1846d8ba15e37b0f20c83ae5c
parentsway/ipc: ipc_user_sockaddr: Use sway_assert instead of assert. (diff)
downloadsway-783290e81a5947865c00a5af30c1ba5e2ecd1052.tar.gz
sway-783290e81a5947865c00a5af30c1ba5e2ecd1052.tar.zst
sway-783290e81a5947865c00a5af30c1ba5e2ecd1052.zip
sway/ipc: Use sway_abort instead of returning NULL.
-rw-r--r--sway/ipc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index dba2acb3..e4deb4d4 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -82,8 +82,8 @@ 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 if (!sway_assert(ipc_sockaddr != NULL, "can't malloc ipc_sockaddr")) { 85 if (ipc_sockaddr == NULL) {
86 return NULL; 86 sway_abort("can't malloc ipc_sockaddr");
87 } 87 }
88 88
89 ipc_sockaddr->sun_family = AF_UNIX; 89 ipc_sockaddr->sun_family = AF_UNIX;
@@ -93,8 +93,8 @@ struct sockaddr_un *ipc_user_sockaddr(void) {
93 // Without logind: 93 // Without logind:
94 int allocating_path_size = snprintf(ipc_sockaddr->sun_path, path_size, "/tmp/sway-ipc.%i.sock", getuid()); 94 int allocating_path_size = snprintf(ipc_sockaddr->sun_path, path_size, "/tmp/sway-ipc.%i.sock", getuid());
95 95
96 if (!sway_assert(allocating_path_size < path_size, "socket path won't fit into ipc_sockaddr->sun_path")) { 96 if (allocating_path_size >= path_size) {
97 return NULL; 97 sway_abort("socket path won't fit into ipc_sockaddr->sun_path");
98 } 98 }
99 99
100 return ipc_sockaddr; 100 return ipc_sockaddr;