2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

use NULL (not 0) for null pointers; use size_t (not unsigned int) in

sysctl() arguments
This commit is contained in:
Andreas Gustafsson
1999-11-30 22:13:26 +00:00
parent d8c70cbcd7
commit 79c08618e9

View File

@@ -66,6 +66,8 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp)
{
isc_interfaceiter_t *iter;
isc_result_t result;
size_t bufsize;
size_t bufused;
REQUIRE(mctx != NULL);
REQUIRE(iterp != NULL);
REQUIRE(*iterp == NULL);
@@ -78,13 +80,15 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp)
iter->buf = 0;
/* Determine the amount of memory needed. */
if (sysctl(mib, 6, 0, &iter->bufsize, 0, 0) < 0) {
bufsize = 0;
if (sysctl(mib, 6, NULL, &bufsize, NULL, (size_t) 0) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"getting interface list size: sysctl: %s",
strerror(errno));
result = ISC_R_UNEXPECTED;
goto failure;
}
iter->bufsize = bufsize;
iter->buf = isc_mem_get(iter->mctx, iter->bufsize);
if (iter->buf == NULL) {
@@ -92,14 +96,15 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp)
goto failure;
}
iter->bufused = iter->bufsize;
if (sysctl(mib, 6, iter->buf, &iter->bufused, 0, 0) < 0) {
bufused = bufsize;
if (sysctl(mib, 6, iter->buf, &bufused, NULL, (size_t) 0) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"getting interface list: sysctl: %s",
strerror(errno));
result = ISC_R_UNEXPECTED;
goto failure;
}
iter->bufused = bufused;
INSIST(iter->bufused <= iter->bufsize);
/*