src: switch asserts to wl_abort

assert()s can be compiled away by #defining NDEBUG. Some build systems
do this. Using wl_abort gives a human readable error message and it
isn't compiled away. This commit closes issue #230.

Signed-off-by: meltq <tejasvipin76@gmail.com>
This commit is contained in:
meltq 2024-06-30 22:36:11 +05:30 committed by Tejas Vipin
parent fa1811ce3e
commit 0cecde304f
5 changed files with 36 additions and 16 deletions

View file

@ -1714,7 +1714,8 @@ wl_socket_init_for_display_name(struct wl_socket *s, const char *name)
name_size = snprintf(s->addr.sun_path, sizeof s->addr.sun_path,
"%s%s%s", runtime_dir, separator, name) + 1;
assert(name_size > 0);
if (!(name_size > 0))
wl_abort("Error assigning path name for socket address\n");
if (name_size > (int)sizeof s->addr.sun_path) {
wl_log("error: socket path \"%s%s%s\" plus null terminator"
" exceeds 108 bytes\n", runtime_dir, separator, name);