svn commit: r233770 - head/lib/libc/net

Xin LI delphij at FreeBSD.org
Mon Apr 2 07:42:18 UTC 2012


Author: delphij
Date: Mon Apr  2 07:42:17 2012
New Revision: 233770
URL: http://svn.freebsd.org/changeset/base/233770

Log:
  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

Modified:
  head/lib/libc/net/getaddrinfo.c
  head/lib/libc/net/name6.c

Modified: head/lib/libc/net/getaddrinfo.c
==============================================================================
--- head/lib/libc/net/getaddrinfo.c	Mon Apr  2 07:18:31 2012	(r233769)
+++ head/lib/libc/net/getaddrinfo.c	Mon Apr  2 07:42:17 2012	(r233770)
@@ -847,8 +847,6 @@ set_source(struct ai_order *aio, struct 
 		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) {

Modified: head/lib/libc/net/name6.c
==============================================================================
--- head/lib/libc/net/name6.c	Mon Apr  2 07:18:31 2012	(r233769)
+++ head/lib/libc/net/name6.c	Mon Apr  2 07:42:17 2012	(r233770)
@@ -884,8 +884,6 @@ set_source(struct hp_order *aio, struct 
 		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) {


More information about the svn-src-head mailing list