Commit 27e48d2e authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

don't test errno if there has been no error

parent de0e5c4f
...@@ -85,9 +85,18 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) ...@@ -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) ...@@ -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: "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment