summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client/rsync.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:30:18 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:30:18 +0000
commit8d82387b5156480b1f77d5c3eb2adcd93f870f74 (patch)
treebbc587961d5e003b4f5d07a59d4904835e829b2d /usr.sbin/rpki-client/rsync.c
parent3da86e2f55552de4b0d297bf96a123a724fa3bea (diff)
Adjust rpki-client to new msgbuf API
OK tb@
Diffstat (limited to 'usr.sbin/rpki-client/rsync.c')
-rw-r--r--usr.sbin/rpki-client/rsync.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/rpki-client/rsync.c b/usr.sbin/rpki-client/rsync.c
index 8ef188c7504..d8612a57ce2 100644
--- a/usr.sbin/rpki-client/rsync.c
+++ b/usr.sbin/rpki-client/rsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsync.c,v 1.54 2024/11/21 13:28:54 claudio Exp $ */
+/* $OpenBSD: rsync.c,v 1.55 2024/11/21 13:30:17 claudio Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -226,7 +226,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
{
int nprocs = 0, npending = 0, rc = 0;
struct pollfd pfd;
- struct msgbuf msgq;
+ struct msgbuf *msgq;
struct ibuf *b, *inbuf = NULL;
sigset_t mask, oldmask;
struct rsync *s, *ns;
@@ -234,7 +234,8 @@ proc_rsync(char *prog, char *bind_addr, int fd)
if (pledge("stdio rpath proc exec unveil", NULL) == -1)
err(1, "pledge");
- msgbuf_init(&msgq);
+ if ((msgq = msgbuf_new()) == NULL)
+ err(1, NULL);
pfd.fd = fd;
/*
@@ -293,7 +294,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
pfd.events = 0;
pfd.events |= POLLIN;
- if (msgbuf_queuelen(&msgq) > 0)
+ if (msgbuf_queuelen(msgq) > 0)
pfd.events |= POLLOUT;
if (npending > 0 && nprocs < MAX_RSYNC_REQUESTS) {
@@ -342,7 +343,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
b = io_new_buffer();
io_simple_buffer(b, &s->id, sizeof(s->id));
io_simple_buffer(b, &ok, sizeof(ok));
- io_close_buffer(&msgq, b);
+ io_close_buffer(msgq, b);
rsync_free(s);
nprocs--;
@@ -354,7 +355,7 @@ proc_rsync(char *prog, char *bind_addr, int fd)
}
if (pfd.revents & POLLOUT) {
- if (msgbuf_write(fd, &msgq) == -1) {
+ if (msgbuf_write(fd, msgq) == -1) {
if (errno == EPIPE)
errx(1, "write: connection closed");
else
@@ -404,6 +405,6 @@ proc_rsync(char *prog, char *bind_addr, int fd)
rsync_free(s);
}
- msgbuf_clear(&msgq);
+ msgbuf_free(msgq);
exit(rc);
}