Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: dhcpd(8): make pollfd array slot handling more robust
To:
David Gwynne <david@gwynne.id.au>
Cc:
tech@openbsd.org
Date:
Sat, 31 May 2025 09:06:49 +0200

Download raw body.

Thread
On Sat, May 31, 2025 at 04:35:45PM +1000, David Gwynne wrote:
> ive been working on a big change to dhcpd internals and hit a problem
> where this code would get confused about which fd generated which event.
> this simplifies the handling by storing the pfd index used by the event
> sources to make it easy to marry them up after poll() returns.
> 
> i think it's easier to read too.
> 
> ok?

ok

> +			if (fds[i].revents & (POLLIN | POLLHUP))
> +				(*(l->handler))(l);

I would get rid of this weird sigil soup idiom for calling a function
pointer and simply do

				l->handler(l);

which does the same thing and is a lot less ugly (there's at least one
more of these in this file).