From: Rafael Sadowski Subject: Re: relayd: fix DEBUG build To: Theo Buehler , jan@openbsd.org Cc: tech@openbsd.org Date: Mon, 18 May 2026 18:17:02 +0200 On Mon May 18, 2026 at 09:18:20AM +0200, Theo Buehler wrote: > On Mon, May 18, 2026 at 08:35:06AM +0200, Rafael Sadowski wrote: > > Simple diff to fix the build with -DDEBUG. OK? > > > > diff --git a/usr.sbin/relayd/Makefile b/usr.sbin/relayd/Makefile > > index db2ed0f0867..008a636dae3 100644 > > --- a/usr.sbin/relayd/Makefile > > +++ b/usr.sbin/relayd/Makefile > > @@ -11,6 +11,7 @@ MAN= relayd.8 relayd.conf.5 > > > > LDADD= -lagentx -levent -ltls -lssl -lcrypto -lutil > > DPADD= ${LIBAGENTX} ${LIBEVENT} ${LIBSSL} ${LIBCRYPTO} ${LIBUTIL} > > +#DEBUG= -g -DDEBUG=3 -O0 > > CFLAGS+= -Wall -I${.CURDIR} > > CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes > > CFLAGS+= -Wmissing-declarations > > diff --git a/usr.sbin/relayd/config.c b/usr.sbin/relayd/config.c > > index d5ab25f76f4..4e1a6879848 100644 > > --- a/usr.sbin/relayd/config.c > > +++ b/usr.sbin/relayd/config.c > > @@ -1179,7 +1179,7 @@ config_getrelayfd(struct relayd *env, struct imsg *imsg) > > > > DPRINTF("%s: %s %d received relay fd %d type %d for relay %s", __func__, > > env->sc_ps->ps_title[privsep_process], env->sc_ps->ps_instance, > > - imsg->fd, crfd.type, rlay->rl_conf.name); > > + imsg_get_fd(imsg), crfd.type, rlay->rl_conf.name); > > imsg_get_fd() removes the fd from imsg and sets it to -1, so this will > (almost?) always print -1. I think this should just be removed from the > DPRINTF. > Oh, thanks for pointing that out. In my experience, a "get" doesn't involve any changes to the data. I have another diff with imsg_get_{pid,type...}. I'll have to take a closer look at all that. This should be the minimal fix. Thanks Jan. diff --git a/usr.sbin/relayd/Makefile b/usr.sbin/relayd/Makefile index db2ed0f0867..008a636dae3 100644 --- a/usr.sbin/relayd/Makefile +++ b/usr.sbin/relayd/Makefile @@ -11,6 +11,7 @@ MAN= relayd.8 relayd.conf.5 LDADD= -lagentx -levent -ltls -lssl -lcrypto -lutil DPADD= ${LIBAGENTX} ${LIBEVENT} ${LIBSSL} ${LIBCRYPTO} ${LIBUTIL} +#DEBUG= -g -DDEBUG=3 -O0 CFLAGS+= -Wall -I${.CURDIR} CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes CFLAGS+= -Wmissing-declarations diff --git a/usr.sbin/relayd/config.c b/usr.sbin/relayd/config.c index d5ab25f76f4..0d236f8dd13 100644 --- a/usr.sbin/relayd/config.c +++ b/usr.sbin/relayd/config.c @@ -1177,9 +1177,9 @@ config_getrelayfd(struct relayd *env, struct imsg *imsg) break; } - DPRINTF("%s: %s %d received relay fd %d type %d for relay %s", __func__, + DPRINTF("%s: %s %d received relay type %d for relay %s", __func__, env->sc_ps->ps_title[privsep_process], env->sc_ps->ps_instance, - imsg->fd, crfd.type, rlay->rl_conf.name); + crfd.type, rlay->rl_conf.name); return (0); }