From 7800f15587ab88fa6d6285f051c5d8212b49442c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 24 Feb 2021 07:52:10 +0700 Subject: [PATCH] helper: wl-socket: fix build for musl bind(2) expects its second parameters is a "const struct sockaddr*", let's cast the "struct sockaddr_un*" to "struct sockaddr*" before passing into bind(2). SUN_LEN is a BSD extension that also implemented by GNU, let's define _DEFAULT_SOURCE before including "sys/un.h". --- src/helpers/wayland_wrapper/wl-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/wayland_wrapper/wl-socket.c b/src/helpers/wayland_wrapper/wl-socket.c index 34eb593054..24cbc2f7e4 100644 --- a/src/helpers/wayland_wrapper/wl-socket.c +++ b/src/helpers/wayland_wrapper/wl-socket.c @@ -8,6 +8,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ +#define _DEFAULT_SOURCE #include #include #include @@ -155,7 +156,7 @@ struct wl_socket *wl_socket_create() s->fd = socket(PF_LOCAL, SOCK_STREAM, 0); int size = SUN_LEN(&s->addr); - int ret = bind(s->fd, &s->addr, size); + int ret = bind(s->fd, (struct sockaddr*)&s->addr, size); if (ret < 0) { goto fail; }