diff options
-rw-r--r-- | networking/libiproute/iproute.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index acb5169a4..2ff99570e 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -57,9 +57,9 @@ static int flush_update(void) | |||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | static int get_hz(void) | 60 | static unsigned get_hz(void) |
61 | { | 61 | { |
62 | static int hz_internal; | 62 | static unsigned hz_internal; |
63 | FILE *fp; | 63 | FILE *fp; |
64 | 64 | ||
65 | if (hz_internal) | 65 | if (hz_internal) |
@@ -272,15 +272,11 @@ static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED, | |||
272 | ci = RTA_DATA(tb[RTA_CACHEINFO]); | 272 | ci = RTA_DATA(tb[RTA_CACHEINFO]); |
273 | } | 273 | } |
274 | if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) { | 274 | if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) { |
275 | static int hz; | ||
276 | if (!hz) { | ||
277 | hz = get_hz(); | ||
278 | } | ||
279 | if (r->rtm_flags & RTM_F_CLONED) { | 275 | if (r->rtm_flags & RTM_F_CLONED) { |
280 | fprintf(fp, "%s cache ", _SL_); | 276 | fprintf(fp, "%s cache ", _SL_); |
281 | } | 277 | } |
282 | if (ci->rta_expires) { | 278 | if (ci->rta_expires) { |
283 | fprintf(fp, " expires %dsec", ci->rta_expires/hz); | 279 | fprintf(fp, " expires %dsec", ci->rta_expires / get_hz()); |
284 | } | 280 | } |
285 | if (ci->rta_error != 0) { | 281 | if (ci->rta_error != 0) { |
286 | fprintf(fp, " error %d", ci->rta_error); | 282 | fprintf(fp, " error %d", ci->rta_error); |