bind() returns -1 on failure and sets errno. The code was passing the
return value `r` (which is always -1) to isc_errno_toresult() instead
of `errno`, causing incorrect error codes to be reported for netlink
bind failures.
sa.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
r = bind(fd, (struct sockaddr *)&sa, sizeof(sa));
if (r < 0) {
+ isc_result_t result = isc_errno_toresult(errno);
isc__nm_closesocket(fd);
- return isc_errno_toresult(r);
+ return result;
}
#endif