summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/imsg.c7
-rw-r--r--lib/libutil/imsg_init.311
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/libutil/imsg.c b/lib/libutil/imsg.c
index c24967a424c..bc9bc590f68 100644
--- a/lib/libutil/imsg.c
+++ b/lib/libutil/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.24 2024/11/21 12:47:27 claudio Exp $ */
+/* $OpenBSD: imsg.c,v 1.25 2024/11/21 12:48:02 claudio Exp $ */
/*
* Copyright (c) 2023 Claudio Jeker <claudio@openbsd.org>
@@ -324,11 +324,6 @@ imsg_forward(struct imsgbuf *imsgbuf, struct imsg *msg)
struct ibuf *wbuf;
size_t len = 0;
- if (msg->fd != -1) {
- close(msg->fd);
- msg->fd = -1;
- }
-
if (msg->buf != NULL) {
ibuf_rewind(msg->buf);
len = ibuf_size(msg->buf);
diff --git a/lib/libutil/imsg_init.3 b/lib/libutil/imsg_init.3
index d61610151a3..f1ade4ab40d 100644
--- a/lib/libutil/imsg_init.3
+++ b/lib/libutil/imsg_init.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: imsg_init.3,v 1.33 2023/12/29 11:48:47 claudio Exp $
+.\" $OpenBSD: imsg_init.3,v 1.34 2024/11/21 12:48:02 claudio Exp $
.\"
.\" Copyright (c) 2023 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2010 Nicholas Marriott <nicm@openbsd.org>
@@ -15,7 +15,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 29 2023 $
+.Dd $Mdocdate: November 21 2024 $
.Dt IMSG_INIT 3
.Os
.Sh NAME
@@ -224,7 +224,10 @@ forwards a just received
.Fa msg
unaltered on
.Fa imsgbuf .
-Any attached file descriptor is closed.
+File descriptors are not forwarded by this function.
+It is possible to call
+.Fn imsg_forward
+more than once per message.
.Pp
.Fn imsg_flush
calls
@@ -280,6 +283,8 @@ returns 0.
.Fn imsg_get_fd
returns the file descriptor and passes the responsibility to track the
descriptor back to the program.
+Unclaimed file descriptors are closed by
+.Fn imsg_free .
.Pp
.Fn imsg_get_data
and