[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

svn commit: r187253 - head/sbin/ifconfig



Author: sam
Date: Wed Jan 14 22:55:49 2009
New Revision: 187253
URL: http://svn.freebsd.org/changeset/base/187253

Log:
  use correct interface name when setting flags; fixes ifconfig ... create ... up
  
  Noticed by:	Chris Anderson

Modified:
  head/sbin/ifconfig/ifconfig.c

Modified: head/sbin/ifconfig/ifconfig.c
==============================================================================
--- head/sbin/ifconfig/ifconfig.c	Wed Jan 14 22:46:13 2009	(r187252)
+++ head/sbin/ifconfig/ifconfig.c	Wed Jan 14 22:55:49 2009	(r187253)
@@ -697,13 +697,13 @@ setifflags(const char *vname, int value,
 	struct ifreq		my_ifr;
 	int flags;
 
-	bcopy((char *)&ifr, (char *)&my_ifr, sizeof(struct ifreq));
+	memset(&my_ifr, 0, sizeof(my_ifr));
+	(void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name));
 
  	if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) < 0) {
  		Perror("ioctl (SIOCGIFFLAGS)");
  		exit(1);
  	}
-	strncpy(my_ifr.ifr_name, name, sizeof (my_ifr.ifr_name));
 	flags = (my_ifr.ifr_flags & 0xffff) | (my_ifr.ifr_flagshigh << 16);
 
 	if (value < 0) {
_______________________________________________
svn-src-all_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe_(_at_)_freebsd_(_dot_)_org"