Commit 83a859c8 authored by Danh Doan's avatar Danh Doan Committed by Vlad Zahorodnii
Browse files

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".

(cherry picked from commit 7800f155)
parent 3dc79a6f
......@@ -8,6 +8,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#define _DEFAULT_SOURCE
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment