From: Giovanni Bechis Subject: Re: mail/opensmtpd-extras: use imsg_get_fd() To: Omar Polo , Joerg Jung Cc: ports@openbsd.org Date: Wed, 31 Jan 2024 18:04:16 +0100 On 1/30/24 17:02, Omar Polo wrote: > This should make opensmtpd-extras work with a future imsg.fd removal. > > m_forward() is not used at all in -extras, so I could have also used -1 > there, it doesn't matter. > > The queues are doing imsg passing, so the second hunk is actually > needed, even if I doubt anyone is using them? anyway, the diff is > simple enough that I'm confident I'm not breaking anything. > > There is still one hit of 'imsg->fd' in api/filter_api.c, but that file > is not used anymore, and so I haven't touched it. The diff makes sense, the diff should also be committed upstream. ok giovanni@  Thanks   Giovanni > Index: Makefile > =================================================================== > RCS file: /home/cvs/ports/mail/opensmtpd-extras/Makefile,v > diff -u -p -r1.37 Makefile > --- Makefile 26 Sep 2023 12:28:13 -0000 1.37 > +++ Makefile 30 Jan 2024 15:55:03 -0000 > @@ -11,8 +11,11 @@ PKGNAME-mysql= opensmtpd-extras-mysql-$ > PKGNAME-pgsql= opensmtpd-extras-pgsql-${V} > PKGNAME-python= opensmtpd-extras-python-${V} > PKGNAME-redis= opensmtpd-extras-redis-${V} > -REVISION-mysql= 0 > -REVISION-pgsql= 0 > +REVISION-main= 0 > +REVISION-mysql= 1 > +REVISION-pgsql= 1 > +REVISION-python= 0 > +REVISION-redis= 0 > EPOCH= 0 > > CATEGORIES= mail > Index: patches/patch-api_mproc_c > =================================================================== > RCS file: patches/patch-api_mproc_c > diff -N patches/patch-api_mproc_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-api_mproc_c 30 Jan 2024 15:57:35 -0000 > @@ -0,0 +1,14 @@ > +use imsg_get_fd() > + > +Index: api/mproc.c > +--- api/mproc.c.orig > ++++ api/mproc.c > +@@ -306,7 +306,7 @@ void > + m_forward(struct mproc *p, struct imsg *imsg) > + { > + imsg_compose(&p->imsgbuf, imsg->hdr.type, imsg->hdr.peerid, > +- imsg->hdr.pid, imsg->fd, imsg->data, > ++ imsg->hdr.pid, imsg_get_fd(imsg), imsg->data, > + imsg->hdr.len - sizeof(imsg->hdr)); > + > + log_trace(TRACE_MPROC, "mproc: %s -> %s : %zu %s (forward)", > Index: patches/patch-api_queue_api_c > =================================================================== > RCS file: patches/patch-api_queue_api_c > diff -N patches/patch-api_queue_api_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-api_queue_api_c 30 Jan 2024 15:57:35 -0000 > @@ -0,0 +1,14 @@ > +use imsg_get_fd > + > +Index: api/queue_api.c > +--- api/queue_api.c.orig > ++++ api/queue_api.c > +@@ -171,7 +171,7 @@ queue_msg_dispatch(void) > + log_warn("warn: queue-api: mkstemp"); > + } > + else { > +- ifile = fdopen(imsg.fd, "r"); > ++ ifile = fdopen(imsg_get_fd(&imsg), "r"); > + ofile = fdopen(fd, "w"); > + m = n = 0; > + if (ifile && ofile) {