diff options
author | Kristof Provost <kp@FreeBSD.org> | 2020-04-23 21:16:51 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2020-04-23 21:16:51 +0000 |
commit | 36dcd97de36daa64a387867e57fe48120256898a (patch) | |
tree | 90b1e79c126b2c052cccefc895d921cc4b57ea84 /lib | |
parent | 9d433cb875e9540b072d3fb200f32b364e18cf40 (diff) | |
download | src-test2-36dcd97de36daa64a387867e57fe48120256898a.tar.gz src-test2-36dcd97de36daa64a387867e57fe48120256898a.zip |
Notes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/if_indextoname.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libc/net/if_indextoname.c b/lib/libc/net/if_indextoname.c index 908e771c4a4e..454823e5e016 100644 --- a/lib/libc/net/if_indextoname.c +++ b/lib/libc/net/if_indextoname.c @@ -66,6 +66,11 @@ if_indextoname(unsigned int ifindex, char *ifname) struct ifaddrs *ifaddrs, *ifa; int error = 0; + if (ifindex == 0) { + errno = ENXIO; + return(NULL); + } + if (getifaddrs(&ifaddrs) < 0) return(NULL); /* getifaddrs properly set errno */ |