From: Michal Nowak Date: Mon, 29 Jun 2026 11:40:50 +0000 (+0000) Subject: Assert fd validity in start_udp_child() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=992674e3509112107fd6aa2a14ca0daa5313dd35;p=thirdparty%2Fbind9.git Assert fd validity in start_udp_child() load_balance_sockets is fixed at netmgr init, so dup(fd) runs only when the caller supplied a valid descriptor. Assert it to silence a scan-build false positive: lib/isc/netmgr/udp.c:194:15: warning: The 1st argument to 'dup' is -1 but should be >= 0 [unix.StdCLibraryFunctions] Assisted-by: Claude:claude-opus-4-8 --- diff --git a/lib/isc/netmgr/udp.c b/lib/isc/netmgr/udp.c index 7922683bdc9..fa79717fb77 100644 --- a/lib/isc/netmgr/udp.c +++ b/lib/isc/netmgr/udp.c @@ -191,6 +191,7 @@ start_udp_child(isc_sockaddr_t *iface, isc_nmsocket_t *sock, uv_os_sock_t fd, if (isc__netmgr->load_balance_sockets) { csock->fd = isc__nm_udp_lb_socket(iface->type.sa.sa_family); } else { + INSIST(fd >= 0); csock->fd = dup(fd); } INSIST(csock->fd >= 0);