mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
don't test errno if there has been no error
This commit is contained in:
@@ -85,9 +85,18 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp)
|
|||||||
|
|
||||||
iter->ifc.ifc_len = iter->bufsize;
|
iter->ifc.ifc_len = iter->bufsize;
|
||||||
iter->ifc.ifc_buf = iter->buf;
|
iter->ifc.ifc_buf = iter->buf;
|
||||||
if (ioctl(iter->socket, SIOCGIFCONF, (char *) &iter->ifc) >= 0)
|
if (ioctl(iter->socket, SIOCGIFCONF, (char *) &iter->ifc) < 0) {
|
||||||
{
|
if (errno != EINVAL) {
|
||||||
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
|
"get interface configuration: %s",
|
||||||
|
strerror(errno));
|
||||||
|
result = ISC_R_UNEXPECTED;
|
||||||
|
goto ioctl_failure;
|
||||||
|
}
|
||||||
|
/* EINVAL. Retry with a bigger buffer. */
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
|
* The ioctl succeeded.
|
||||||
* Some OS's just return what will fit rather
|
* Some OS's just return what will fit rather
|
||||||
* than set EINVAL if the buffer is too small
|
* than set EINVAL if the buffer is too small
|
||||||
* to fit all the interfaces in. If
|
* to fit all the interfaces in. If
|
||||||
@@ -99,14 +108,6 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp)
|
|||||||
< iter->bufsize)
|
< iter->bufsize)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (errno != EINVAL) {
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
||||||
"get interface configuration: %s",
|
|
||||||
strerror(errno));
|
|
||||||
result = ISC_R_UNEXPECTED;
|
|
||||||
goto ioctl_failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iter->bufsize >= IFCONF_BUFSIZE_MAX) {
|
if (iter->bufsize >= IFCONF_BUFSIZE_MAX) {
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
"get interface configuration: "
|
"get interface configuration: "
|
||||||
|
Reference in New Issue
Block a user