mirror of
https://passt.top/passt
synced 2025-02-22 19:02:20 +00:00
repair, passt-repair: Build and warning fixes for musl
Checked against musl 1.2.5. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
01b6a164d9
commit
3e903bbb1f
@ -63,6 +63,7 @@ int main(int argc, char **argv)
|
|||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
|
size_t cmsg_len;
|
||||||
int op;
|
int op;
|
||||||
|
|
||||||
prctl(PR_SET_DUMPABLE, 0);
|
prctl(PR_SET_DUMPABLE, 0);
|
||||||
@ -138,8 +139,9 @@ loop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!n) {
|
if (!n) {
|
||||||
|
cmsg_len = cmsg->cmsg_len; /* socklen_t is 'unsigned' on musl */
|
||||||
fprintf(stderr, "Invalid ancillary data length %zu from peer\n",
|
fprintf(stderr, "Invalid ancillary data length %zu from peer\n",
|
||||||
cmsg->cmsg_len);
|
cmsg_len);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
repair.c
13
repair.c
@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -145,9 +146,9 @@ void repair_handler(struct ctx *c, uint32_t events)
|
|||||||
*/
|
*/
|
||||||
int repair_flush(struct ctx *c)
|
int repair_flush(struct ctx *c)
|
||||||
{
|
{
|
||||||
struct iovec iov = { &repair_cmd, sizeof(repair_cmd) };
|
|
||||||
char buf[CMSG_SPACE(sizeof(int) * SCM_MAX_FD)]
|
char buf[CMSG_SPACE(sizeof(int) * SCM_MAX_FD)]
|
||||||
__attribute__ ((aligned(__alignof__(struct cmsghdr))));
|
__attribute__ ((aligned(__alignof__(struct cmsghdr)))) = { 0 };
|
||||||
|
struct iovec iov = { &repair_cmd, sizeof(repair_cmd) };
|
||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
int8_t reply;
|
int8_t reply;
|
||||||
@ -155,8 +156,12 @@ int repair_flush(struct ctx *c)
|
|||||||
if (!repair_nfds)
|
if (!repair_nfds)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
msg = (struct msghdr){ NULL, 0, &iov, 1,
|
msg = (struct msghdr){ .msg_name = NULL, .msg_namelen = 0,
|
||||||
buf, CMSG_SPACE(sizeof(int) * repair_nfds), 0 };
|
.msg_iov = &iov, .msg_iovlen = 1,
|
||||||
|
.msg_control = buf,
|
||||||
|
.msg_controllen = CMSG_SPACE(sizeof(int) *
|
||||||
|
repair_nfds),
|
||||||
|
.msg_flags = 0 };
|
||||||
cmsg = CMSG_FIRSTHDR(&msg);
|
cmsg = CMSG_FIRSTHDR(&msg);
|
||||||
|
|
||||||
cmsg->cmsg_level = SOL_SOCKET;
|
cmsg->cmsg_level = SOL_SOCKET;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user