]>
Commit | Line | Data |
---|---|---|
6fca7355 ER |
1 | diff -up ntp-4.2.4p2/libisc/ifiter_sysctl.c.noif ntp-4.2.4p2/libisc/ifiter_sysctl.c |
2 | --- ntp-4.2.4p2/libisc/ifiter_sysctl.c.noif 2006-06-06 22:16:23.000000000 +0200 | |
3 | +++ ntp-4.2.4p2/libisc/ifiter_sysctl.c 2007-09-24 16:08:55.000000000 +0200 | |
4 | @@ -309,7 +309,10 @@ internal_destroy(isc_interfaceiter_t *it | |
5 | */ | |
6 | } | |
7 | ||
8 | -static | |
9 | -void internal_first(isc_interfaceiter_t *iter) { | |
10 | +static isc_result_t | |
11 | +internal_first(isc_interfaceiter_t *iter) { | |
12 | iter->pos = 0; | |
13 | + if (iter->pos >= iter->bufused) | |
14 | + return (ISC_R_NOMORE); | |
15 | + return (ISC_R_SUCCESS); | |
16 | } | |
17 | diff -up ntp-4.2.4p2/libisc/ifiter_ioctl.c.noif ntp-4.2.4p2/libisc/ifiter_ioctl.c | |
18 | --- ntp-4.2.4p2/libisc/ifiter_ioctl.c.noif 2007-09-24 16:08:55.000000000 +0200 | |
19 | +++ ntp-4.2.4p2/libisc/ifiter_ioctl.c 2007-09-24 16:08:55.000000000 +0200 | |
20 | @@ -1098,8 +1098,8 @@ internal_destroy(isc_interfaceiter_t *it | |
21 | #endif | |
22 | } | |
23 | ||
24 | -static | |
25 | -void internal_first(isc_interfaceiter_t *iter) { | |
26 | +static isc_result_t | |
27 | +internal_first(isc_interfaceiter_t *iter) { | |
28 | #ifdef HAVE_TRUCLUSTER | |
29 | int clua_result; | |
30 | #endif | |
31 | @@ -1118,5 +1118,10 @@ void internal_first(isc_interfaceiter_t | |
32 | #endif | |
33 | #ifdef __linux | |
34 | linux_if_inet6_first(iter); | |
35 | + if (iter->valid == ISC_R_SUCCESS) | |
36 | + return (iter->valid); | |
37 | #endif | |
38 | + if (iter->pos >= (unsigned int) iter->ifc.ifc_len) | |
39 | + return (ISC_R_NOMORE); | |
40 | + return (ISC_R_SUCCESS); | |
41 | } | |
42 | diff -up ntp-4.2.4p2/libisc/interfaceiter.c.noif ntp-4.2.4p2/libisc/interfaceiter.c | |
43 | --- ntp-4.2.4p2/libisc/interfaceiter.c.noif 2006-06-06 22:16:24.000000000 +0200 | |
44 | +++ ntp-4.2.4p2/libisc/interfaceiter.c 2007-09-24 16:08:55.000000000 +0200 | |
45 | @@ -170,14 +170,11 @@ isc_interfaceiter_first(isc_interfaceite | |
46 | ||
47 | REQUIRE(VALID_IFITER(iter)); | |
48 | ||
49 | - internal_first(iter); | |
50 | - for (;;) { | |
51 | + for (result = internal_first(iter); result == ISC_R_SUCCESS; | |
52 | + result = internal_next(iter)) { | |
53 | result = internal_current(iter); | |
54 | if (result != ISC_R_IGNORE) | |
55 | break; | |
56 | - result = internal_next(iter); | |
57 | - if (result != ISC_R_SUCCESS) | |
58 | - break; | |
59 | } | |
60 | iter->result = result; | |
61 | return (result); | |
62 | diff -up ntp-4.2.4p2/libisc/ifiter_getifaddrs.c.noif ntp-4.2.4p2/libisc/ifiter_getifaddrs.c | |
63 | --- ntp-4.2.4p2/libisc/ifiter_getifaddrs.c.noif 2006-06-06 22:16:22.000000000 +0200 | |
64 | +++ ntp-4.2.4p2/libisc/ifiter_getifaddrs.c 2007-09-24 16:08:55.000000000 +0200 | |
65 | @@ -185,7 +185,10 @@ internal_destroy(isc_interfaceiter_t *it | |
66 | iter->ifaddrs = NULL; | |
67 | } | |
68 | ||
69 | -static | |
70 | -void internal_first(isc_interfaceiter_t *iter) { | |
71 | +static isc_result_t | |
72 | +internal_first(isc_interfaceiter_t *iter) { | |
73 | iter->pos = iter->ifaddrs; | |
74 | + if (iter->pos == NULL) | |
75 | + return (ISC_R_NOMORE); | |
76 | + return (ISC_R_SUCCESS); | |
77 | } |