When I added ibuf_get_fd() the idea was to make sure that ibuf_free() will close any fd still on the buffer. This way even if a fd is unexpectedly passed nothing will happen.
That code was disabled at start because userland was not fully ready. In particular rpki-client did not handle that well. All of this is to my knowledge fixed so there is no reason to keep the NOTYET :) With this users need to use ibuf_fd_get() to take the fd off the ibuf. Code not doing so will break because ibuf_free() will close the fd which is probably still in use somewhere else. -- :wq Claudio Index: imsg-buffer.c =================================================================== RCS file: /cvs/src/lib/libutil/imsg-buffer.c,v retrieving revision 1.16 diff -u -p -r1.16 imsg-buffer.c --- imsg-buffer.c 19 Jun 2023 17:19:50 -0000 1.16 +++ imsg-buffer.c 24 Oct 2023 12:55:44 -0000 @@ -294,10 +294,8 @@ ibuf_free(struct ibuf *buf) { if (buf == NULL) return; -#ifdef NOTYET if (buf->fd != -1) close(buf->fd); -#endif freezero(buf->buf, buf->size); free(buf); } @@ -314,9 +312,7 @@ ibuf_fd_get(struct ibuf *buf) int fd; fd = buf->fd; -#ifdef NOTYET buf->fd = -1; -#endif return (fd); } @@ -480,11 +476,6 @@ static void ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf) { TAILQ_REMOVE(&msgbuf->bufs, buf, entry); - - if (buf->fd != -1) { - close(buf->fd); - buf->fd = -1; - } msgbuf->queued--; ibuf_free(buf);