From 32ffd2336cd9ba0e012ebbab8436d47816d6620e Mon Sep 17 00:00:00 2001 From: Xin LI Date: Mon, 2 Apr 2012 07:42:17 +0000 Subject: [PATCH] Eliminate two cases of unwanted strncpy(). The name is not required by the current code, and the results would get overwritten anyway by subsequent memset(). Reviewed by: ume MFC after: 1 month --- lib/libc/net/getaddrinfo.c | 2 -- lib/libc/net/name6.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 37f09f853e7..8083c390b3b 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -847,8 +847,6 @@ set_source(struct ai_order *aio, struct policyhead *ph) struct in6_ifreq ifr6; u_int32_t flags6; - /* XXX: interface name should not be hardcoded */ - strncpy(ifr6.ifr_name, "lo0", sizeof(ifr6.ifr_name)); memset(&ifr6, 0, sizeof(ifr6)); memcpy(&ifr6.ifr_addr, ai.ai_addr, ai.ai_addrlen); if (_ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) == 0) { diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c index 4864bf4a6f5..0031f462ffc 100644 --- a/lib/libc/net/name6.c +++ b/lib/libc/net/name6.c @@ -884,8 +884,6 @@ set_source(struct hp_order *aio, struct policyhead *ph) struct in6_ifreq ifr6; u_int32_t flags6; - /* XXX: interface name should not be hardcoded */ - strncpy(ifr6.ifr_name, "lo0", sizeof(ifr6.ifr_name)); memset(&ifr6, 0, sizeof(ifr6)); memcpy(&ifr6.ifr_addr, &ss, ss.ss_len); if (_ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) == 0) {