diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-03-13 06:16:12 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-03-13 06:16:12 +0000 |
commit | 13b365f6f238e5960ac51f9669b052023b2a6578 (patch) | |
tree | 7a5abb116706c02c05f0b47e111cf2dd4542be85 /usr.sbin/rtadvd/if.c | |
parent | 09bc8f72a9ed3c3886baf6d772b39aafcd78d661 (diff) |
bring in latest rtadvd source from kame.
this fixes unclosed file descriptor in router renumbering case.
Diffstat (limited to 'usr.sbin/rtadvd/if.c')
-rw-r--r-- | usr.sbin/rtadvd/if.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index 1485e3d5b27..6740ea68787 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.2 1999/12/11 10:33:28 itojun Exp $ */ +/* $OpenBSD: if.c,v 1.3 2000/03/13 06:16:11 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -167,21 +167,22 @@ if_getmtu(char *name) return(ifr.ifr_mtu); #endif #ifdef __bsdi__ - struct ifaddrs *ifa; + struct ifaddrs *ifap, *ifa; struct if_data *ifd; - if (getifaddrs(&ifa) < 0) + if (getifaddrs(&ifap) < 0) return(0); - while (ifa) { + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (strcmp(ifa->ifa_name, name) == 0) { ifd = ifa->ifa_data; + freeifaddrs(ifap); if (ifd) return ifd->ifi_mtu; else return 0; } - ifa = ifa->ifa_next; } + freeifaddrs(ifap); return 0; #endif /* last resort */ |