summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2020-04-23 21:16:51 +0000
committerKristof Provost <kp@FreeBSD.org>2020-04-23 21:16:51 +0000
commit36dcd97de36daa64a387867e57fe48120256898a (patch)
tree90b1e79c126b2c052cccefc895d921cc4b57ea84 /lib
parent9d433cb875e9540b072d3fb200f32b364e18cf40 (diff)
downloadsrc-test2-36dcd97de36daa64a387867e57fe48120256898a.tar.gz
src-test2-36dcd97de36daa64a387867e57fe48120256898a.zip
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/if_indextoname.c5
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 */