From bcc245799be7e90d912bd8d2774465fd9d407707 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 2 Oct 2017 22:05:57 -0300 Subject: lib: nuke the if_*_by_name_len() functions Make use of strnlen() and strlcpy() so we can get rid of these convoluted if_*_by_name_len() functions. Signed-off-by: Renato Westphal --- zebra/if_ioctl.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'zebra/if_ioctl.c') diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 6396911e1b..f31c24ada3 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -105,10 +105,7 @@ static int interface_list_ioctl(void) unsigned int size; ifreq = (struct ifreq *)((caddr_t)ifconf.ifc_req + n); - ifp = if_get_by_name_len( - ifreq->ifr_name, - strnlen(ifreq->ifr_name, sizeof(ifreq->ifr_name)), - VRF_DEFAULT, 0); + ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT, 0); if_add_update(ifp); size = ifreq->ifr_addr.sa_len; if (size < sizeof(ifreq->ifr_addr)) @@ -118,10 +115,7 @@ static int interface_list_ioctl(void) } #else for (n = 0; n < ifconf.ifc_len; n += sizeof(struct ifreq)) { - ifp = if_get_by_name_len( - ifreq->ifr_name, - strnlen(ifreq->ifr_name, sizeof(ifreq->ifr_name)), - VRF_DEFAULT, 0); + ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT, 0); if_add_update(ifp); ifreq++; } -- cgit v1.2.3