Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
[7/7] Check error in proc_forward_imsg
To:
tech@openbsd.org
Date:
Sun, 7 Jun 2026 09:06:26 +0200

Download raw body.

Thread
  • Rafael Sadowski:

    [7/7] Check error in proc_forward_imsg

This is a series of commits for an imsg APIv2 rework in relayd. These
were committed and tested individually. They can be reviewed in their
entirety here:

gothub: https://rsadowski.gothub.org/?action=summary&headref=imsg_v2&path=relayd.git
PR: https://codeberg.org/rsadowski/relayd/pulls/1/files

commit 6350adcb2c5bde6477eb8d4250cbaf0655138bcf
Author: Rafael Sadowski <rafael@sizeofvoid.org>
Date:   Sun Jun 7 08:00:59 2026 +0200

    Check failer in proc_forward_imsg

diff --git a/proc.c b/proc.c
index d38bebd..de1f89d 100644
--- a/proc.c
+++ b/proc.c
@@ -793,7 +793,7 @@ proc_composev(struct privsep *ps, enum privsep_procid id,
 	return (proc_composev_imsg(ps, id, -1, type, -1, -1, iov, iovcnt));
 }
 
-int
+void
 proc_forward_imsg(struct privsep *ps, struct imsg *imsg,
     enum privsep_procid id)
 {
@@ -802,11 +802,9 @@ proc_forward_imsg(struct privsep *ps, struct imsg *imsg,
 	proc_range(ps, id, &n, &m);
 	for (; n < m; n++) {
 		if (imsg_forward(&ps->ps_ievs[id][n].ibuf, imsg) == -1)
-			return (-1);
+			fatal("%s: imsg_forward", __func__);
 		imsg_event_add(&ps->ps_ievs[id][n]);
 	}
-
-	return (0);
 }
 
 struct imsgbuf *
diff --git a/relayd.h b/relayd.h
index ac64966..bd29888 100644
--- a/relayd.h
+++ b/relayd.h
@@ -1417,7 +1417,7 @@ int	 proc_composev_imsg(struct privsep *, enum privsep_procid, int,
 	    u_int16_t, u_int32_t, int, const struct iovec *, int);
 int	 proc_composev(struct privsep *, enum privsep_procid,
 	    uint16_t, const struct iovec *, int);
-int	 proc_forward_imsg(struct privsep *, struct imsg *,
+void	proc_forward_imsg(struct privsep *, struct imsg *,
 	    enum privsep_procid);
 struct imsgbuf *
 	 proc_ibuf(struct privsep *, enum privsep_procid, int);