traceroute: Silence compiler warning

Silence the warning:

argument to 'sizeof' in 'strncpy' call is the same expression as the
source; did you mean to use the size of the destination?"

by using strlcpy() and the size of the destination (device).

No functional change intended.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/901
This commit is contained in:
Jose Luis Duran 2023-11-17 16:15:27 +00:00 committed by Warner Losh
parent 7414d14bd5
commit af87ba6522

View file

@ -141,8 +141,7 @@ ifaddrlist(register struct ifaddrlist **ipaddrp, register char *errbuf)
continue;
(void)strncpy(device, ifr.ifr_name, sizeof(ifr.ifr_name));
device[sizeof(device) - 1] = '\0';
(void)strlcpy(device, ifr.ifr_name, sizeof(device));
#ifdef sun
/* Ignore sun virtual interfaces */
if (strchr(device, ':') != NULL)