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".
This commit is contained in:
parent
9977f21980
commit
7800f15587
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue