summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:35:21 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-11-21 13:35:21 +0000
commit33a588df978f85e7cafd5cb8ad0c0488cf1d643e (patch)
tree88ded2bf783bae19a2722770ae6e67891c2d7758 /sbin
parentbc259033bc5d73dfddade6d795e9a972dda58fba (diff)
Convert sbin and usr.bin to check for imsgbuf_init failure and add
imsgbuf_allow_fdpass where needed. OK tb@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhcp6leased/control.c9
-rw-r--r--sbin/dhcp6leased/dhcp6leased.c10
-rw-r--r--sbin/dhcp6leased/engine.c9
-rw-r--r--sbin/dhcp6leased/frontend.c9
-rw-r--r--sbin/dhcpleased/control.c9
-rw-r--r--sbin/dhcpleased/dhcpleased.c10
-rw-r--r--sbin/dhcpleased/engine.c9
-rw-r--r--sbin/dhcpleased/frontend.c9
-rw-r--r--sbin/iked/control.c9
-rw-r--r--sbin/iked/proc.c12
-rw-r--r--sbin/mountd/mountd.c12
-rw-r--r--sbin/slaacd/control.c9
-rw-r--r--sbin/slaacd/engine.c9
-rw-r--r--sbin/slaacd/frontend.c9
-rw-r--r--sbin/slaacd/slaacd.c10
-rw-r--r--sbin/unwind/control.c9
-rw-r--r--sbin/unwind/frontend.c9
-rw-r--r--sbin/unwind/resolver.c9
-rw-r--r--sbin/unwind/unwind.c10
19 files changed, 128 insertions, 53 deletions
diff --git a/sbin/dhcp6leased/control.c b/sbin/dhcp6leased/control.c
index df3da1035c3..699e5aeac3d 100644
--- a/sbin/dhcp6leased/control.c
+++ b/sbin/dhcp6leased/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.8 2024/11/21 13:21:33 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.9 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -156,7 +156,12 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsgbuf_init(&c->iev.ibuf, connfd);
+ if (imsgbuf_init(&c->iev.ibuf, connfd) == -1) {
+ log_warn("%s: imsgbuf_init", __func__);
+ close(connfd);
+ free(c);
+ return;
+ }
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
diff --git a/sbin/dhcp6leased/dhcp6leased.c b/sbin/dhcp6leased/dhcp6leased.c
index 50ce64edf23..ae29f5a9436 100644
--- a/sbin/dhcp6leased/dhcp6leased.c
+++ b/sbin/dhcp6leased/dhcp6leased.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp6leased.c,v 1.18 2024/11/21 13:21:33 claudio Exp $ */
+/* $OpenBSD: dhcp6leased.c,v 1.19 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -260,9 +260,13 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_engine = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ if (imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_frontend->ibuf);
iev_frontend->handler = main_dispatch_frontend;
- imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]);
+ if (imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_engine->ibuf);
iev_engine->handler = main_dispatch_engine;
/* Setup event handlers for pipes to engine & frontend. */
diff --git a/sbin/dhcp6leased/engine.c b/sbin/dhcp6leased/engine.c
index 0f1ab78f58e..58acebb65b7 100644
--- a/sbin/dhcp6leased/engine.c
+++ b/sbin/dhcp6leased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.29 2024/11/21 13:21:33 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.30 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -215,7 +215,9 @@ engine(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = engine_dispatch_main;
/* Setup event handlers. */
@@ -423,7 +425,8 @@ engine_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, fd);
+ if (imsgbuf_init(&iev_frontend->ibuf, fd) == -1)
+ fatal(NULL);
iev_frontend->handler = engine_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/dhcp6leased/frontend.c b/sbin/dhcp6leased/frontend.c
index 24b3e2afe1d..2abdf8cc7a6 100644
--- a/sbin/dhcp6leased/frontend.c
+++ b/sbin/dhcp6leased/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.19 2024/11/21 13:21:33 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.20 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017, 2021, 2024 Florian Obser <florian@openbsd.org>
@@ -180,7 +180,9 @@ frontend(int debug, int verbose)
/* Setup pipe and event handler to the parent process. */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -282,7 +284,8 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_engine == NULL)
fatal(NULL);
- imsgbuf_init(&iev_engine->ibuf, fd);
+ if (imsgbuf_init(&iev_engine->ibuf, fd) == -1)
+ fatal(NULL);
iev_engine->handler = frontend_dispatch_engine;
iev_engine->events = EV_READ;
diff --git a/sbin/dhcpleased/control.c b/sbin/dhcpleased/control.c
index b342c62d09a..fa0c3dbf6bd 100644
--- a/sbin/dhcpleased/control.c
+++ b/sbin/dhcpleased/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.11 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.12 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -156,7 +156,12 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsgbuf_init(&c->iev.ibuf, connfd);
+ if (imsgbuf_init(&c->iev.ibuf, connfd) == -1) {
+ log_warn("%s: imsgbuf_init", __func__);
+ close(connfd);
+ free(c);
+ return;
+ }
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
diff --git a/sbin/dhcpleased/dhcpleased.c b/sbin/dhcpleased/dhcpleased.c
index 907dbccf5bc..eadb2eb870f 100644
--- a/sbin/dhcpleased/dhcpleased.c
+++ b/sbin/dhcpleased/dhcpleased.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpleased.c,v 1.38 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: dhcpleased.c,v 1.39 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -273,9 +273,13 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_engine = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ if (imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_frontend->ibuf);
iev_frontend->handler = main_dispatch_frontend;
- imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]);
+ if (imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_engine->ibuf);
iev_engine->handler = main_dispatch_engine;
/* Setup event handlers for pipes to engine & frontend. */
diff --git a/sbin/dhcpleased/engine.c b/sbin/dhcpleased/engine.c
index 8cd975af9d0..ba7489f9d3f 100644
--- a/sbin/dhcpleased/engine.c
+++ b/sbin/dhcpleased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.54 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.55 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -226,7 +226,9 @@ engine(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = engine_dispatch_main;
/* Setup event handlers. */
@@ -446,7 +448,8 @@ engine_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, fd);
+ if (imsgbuf_init(&iev_frontend->ibuf, fd) == -1)
+ fatal(NULL);
iev_frontend->handler = engine_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/dhcpleased/frontend.c b/sbin/dhcpleased/frontend.c
index 9fb18677d75..6174792fc34 100644
--- a/sbin/dhcpleased/frontend.c
+++ b/sbin/dhcpleased/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.44 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.45 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -177,7 +177,9 @@ frontend(int debug, int verbose)
/* Setup pipe and event handler to the parent process. */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -283,7 +285,8 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_engine == NULL)
fatal(NULL);
- imsgbuf_init(&iev_engine->ibuf, fd);
+ if (imsgbuf_init(&iev_engine->ibuf, fd) == -1)
+ fatal(NULL);
iev_engine->handler = frontend_dispatch_engine;
iev_engine->events = EV_READ;
diff --git a/sbin/iked/control.c b/sbin/iked/control.c
index 71c46b20954..7bba4cba8ec 100644
--- a/sbin/iked/control.c
+++ b/sbin/iked/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.44 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.45 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -191,7 +191,12 @@ control_accept(int listenfd, short event, void *arg)
return;
}
- imsgbuf_init(&c->iev.ibuf, connfd);
+ if (imsgbuf_init(&c->iev.ibuf, connfd) == -1) {
+ log_warn("%s", __func__);
+ close(connfd);
+ free(c);
+ return;
+ }
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
c->iev.data = cs;
diff --git a/sbin/iked/proc.c b/sbin/iked/proc.c
index 6b914dff0a5..ecff70811ff 100644
--- a/sbin/iked/proc.c
+++ b/sbin/iked/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.50 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: proc.c,v 1.51 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -162,8 +162,10 @@ proc_connect(struct privsep *ps, void (*connected)(struct privsep *))
for (inst = 0; inst < ps->ps_instances[dst]; inst++) {
iev = &ps->ps_ievs[dst][inst];
- imsgbuf_init(&iev->ibuf,
- ps->ps_pp->pp_pipes[dst][inst]);
+ if (imsgbuf_init(&iev->ibuf,
+ ps->ps_pp->pp_pipes[dst][inst]) == -1)
+ fatal("%s: imsgbuf_init", __func__);
+ imsgbuf_allow_fdpass(&iev->ibuf);
event_set(&iev->ev, iev->ibuf.fd, iev->events,
iev->handler, iev->data);
event_add(&iev->ev, NULL);
@@ -293,7 +295,9 @@ proc_accept(struct privsep *ps, int fd, enum privsep_procid dst,
pp->pp_pipes[dst][n] = fd;
iev = &ps->ps_ievs[dst][n];
- imsgbuf_init(&iev->ibuf, fd);
+ if (imsgbuf_init(&iev->ibuf, fd) == -1)
+ fatal("%s: imsgbuf_init", __func__);
+ imsgbuf_allow_fdpass(&iev->ibuf);
event_set(&iev->ev, iev->ibuf.fd, iev->events, iev->handler, iev->data);
event_add(&iev->ev, NULL);
}
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 71af0373db9..4d56fe5aff5 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.95 2024/11/21 13:24:07 claudio Exp $ */
+/* $OpenBSD: mountd.c,v 1.96 2024/11/21 13:35:20 claudio Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -321,7 +321,10 @@ main(int argc, char *argv[])
}
signal(SIGTERM, (void (*)(int)) send_umntall);
- imsgbuf_init(&ibuf, socks[0]);
+ if (imsgbuf_init(&ibuf, socks[0]) == -1) {
+ syslog(LOG_ERR, "imsgbuf_init: %m");
+ exit(1);
+ }
setproctitle("parent");
if (debug)
@@ -370,7 +373,10 @@ privchild(int sock)
char *path;
int error, size;
- imsgbuf_init(&ibuf, sock);
+ if (imsgbuf_init(&ibuf, sock) == -1) {
+ syslog(LOG_ERR, "imsgbuf_init: %m");
+ _exit(1);
+ }
setproctitle("[priv]");
fp = NULL;
diff --git a/sbin/slaacd/control.c b/sbin/slaacd/control.c
index 948f3083327..f467adf9563 100644
--- a/sbin/slaacd/control.c
+++ b/sbin/slaacd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.16 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.17 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -157,7 +157,12 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsgbuf_init(&c->iev.ibuf, connfd);
+ if (imsgbuf_init(&c->iev.ibuf, connfd) == -1) {
+ log_warn("%s: imsgbuf_init", __func__);
+ close(connfd);
+ free(c);
+ return;
+ }
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events,
diff --git a/sbin/slaacd/engine.c b/sbin/slaacd/engine.c
index f825bfb41ee..8f1bd038533 100644
--- a/sbin/slaacd/engine.c
+++ b/sbin/slaacd/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.98 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.99 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -396,7 +396,9 @@ engine(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = engine_dispatch_main;
/* Setup event handlers. */
@@ -673,7 +675,8 @@ engine_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, fd);
+ if (imsgbuf_init(&iev_frontend->ibuf, fd) == -1)
+ fatal(NULL);
iev_frontend->handler = engine_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c
index d0e9fa5d618..c3f02dc7cd6 100644
--- a/sbin/slaacd/frontend.c
+++ b/sbin/slaacd/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.73 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.74 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -179,7 +179,9 @@ frontend(int debug, int verbose)
/* Setup pipe and event handler to the parent process. */
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -327,7 +329,8 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_engine == NULL)
fatal(NULL);
- imsgbuf_init(&iev_engine->ibuf, fd);
+ if (imsgbuf_init(&iev_engine->ibuf, fd) == -1)
+ fatal(NULL);
iev_engine->handler = frontend_dispatch_engine;
iev_engine->events = EV_READ;
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index 1c231af0848..3a307e94d03 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.78 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: slaacd.c,v 1.79 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -230,9 +230,13 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_engine = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ if (imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_frontend->ibuf);
iev_frontend->handler = main_dispatch_frontend;
- imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]);
+ if (imsgbuf_init(&iev_engine->ibuf, pipe_main2engine[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_engine->ibuf);
iev_engine->handler = main_dispatch_engine;
/* Setup event handlers for pipes to engine & frontend. */
diff --git a/sbin/unwind/control.c b/sbin/unwind/control.c
index 0b79362e9ac..2fab6ddb9fd 100644
--- a/sbin/unwind/control.c
+++ b/sbin/unwind/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.22 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.23 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -156,7 +156,12 @@ control_accept(int listenfd, short event, void *bula)
return;
}
- imsgbuf_init(&c->iev.ibuf, connfd);
+ if (imsgbuf_init(&c->iev.ibuf, connfd) == -1) {
+ log_warn("%s: imsgbuf_init", __func__);
+ close(connfd);
+ free(c);
+ return;
+ }
c->iev.handler = control_dispatch_imsg;
c->iev.events = EV_READ;
event_set(&c->iev.ev, c->iev.ibuf.fd, c->iev.events, c->iev.handler,
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c
index 1312540af37..ad379645084 100644
--- a/sbin/unwind/frontend.c
+++ b/sbin/unwind/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.88 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: frontend.c,v 1.89 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -233,7 +233,9 @@ frontend(int debug, int verbose)
fatal("iev_main");
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = frontend_dispatch_main;
iev_main->events = EV_READ;
event_set(&iev_main->ev, iev_main->ibuf.fd, iev_main->events,
@@ -355,7 +357,8 @@ frontend_dispatch_main(int fd, short event, void *bula)
if (iev_resolver == NULL)
fatal(NULL);
- imsgbuf_init(&iev_resolver->ibuf, fd);
+ if (imsgbuf_init(&iev_resolver->ibuf, fd) == -1)
+ fatal(NULL);
iev_resolver->handler = frontend_dispatch_resolver;
iev_resolver->events = EV_READ;
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index 8010761f82a..3ab2be514aa 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.172 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: resolver.c,v 1.173 2024/11/21 13:35:20 claudio Exp $ */
/*
@@ -415,7 +415,9 @@ resolver(int debug, int verbose)
if ((iev_main = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_main->ibuf, 3);
+ if (imsgbuf_init(&iev_main->ibuf, 3) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_main->ibuf);
iev_main->handler = resolver_dispatch_main;
/* Setup event handlers. */
@@ -671,7 +673,8 @@ resolver_dispatch_main(int fd, short event, void *bula)
if (iev_frontend == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, fd);
+ if (imsgbuf_init(&iev_frontend->ibuf, fd) == -1)
+ fatal(NULL);
iev_frontend->handler = resolver_dispatch_frontend;
iev_frontend->events = EV_READ;
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index 830b410ac58..b52646490d1 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.74 2024/11/21 13:21:34 claudio Exp $ */
+/* $OpenBSD: unwind.c,v 1.75 2024/11/21 13:35:20 claudio Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -239,9 +239,13 @@ main(int argc, char *argv[])
if ((iev_frontend = malloc(sizeof(struct imsgev))) == NULL ||
(iev_resolver = malloc(sizeof(struct imsgev))) == NULL)
fatal(NULL);
- imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]);
+ if (imsgbuf_init(&iev_frontend->ibuf, pipe_main2frontend[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_frontend->ibuf);
iev_frontend->handler = main_dispatch_frontend;
- imsgbuf_init(&iev_resolver->ibuf, pipe_main2resolver[0]);
+ if (imsgbuf_init(&iev_resolver->ibuf, pipe_main2resolver[0]) == -1)
+ fatal(NULL);
+ imsgbuf_allow_fdpass(&iev_resolver->ibuf);
iev_resolver->handler = main_dispatch_resolver;
/* Setup event handlers for pipes. */