fix: compilation on some os

This commit is contained in:
Alex 2019-05-16 17:09:25 +02:00
parent 31f63398dc
commit e12766a656
1 changed files with 13 additions and 3 deletions

View File

@ -368,7 +368,12 @@ int waybar::modules::Network::netlinkRequest(void *req, uint32_t reqlen, uint32_
sa.nl_family = AF_NETLINK;
sa.nl_groups = groups;
struct iovec iov = {req, reqlen};
struct msghdr msg = {&sa, sizeof(sa), &iov, 1, nullptr, 0, 0};
struct msghdr msg = {
.msg_name = &sa,
.msg_namelen = sizeof(sa),
.msg_iov = &iov,
.msg_iovlen = 1,
};
return sendmsg(nl_socket_get_fd(ev_sock_), &msg, 0);
}
@ -377,7 +382,12 @@ int waybar::modules::Network::netlinkResponse(void *resp, uint32_t resplen, uint
sa.nl_family = AF_NETLINK;
sa.nl_groups = groups;
struct iovec iov = {resp, resplen};
struct msghdr msg = {&sa, sizeof(sa), &iov, 1, nullptr, 0, 0};
struct msghdr msg = {
.msg_name = &sa,
.msg_namelen = sizeof(sa),
.msg_iov = &iov,
.msg_iovlen = 1,
};
auto ret = recvmsg(nl_socket_get_fd(ev_sock_), &msg, 0);
if (msg.msg_flags & MSG_TRUNC) {
return -1;