Date: Wed, 14 Jan 2009 22:55:49 +0000 (UTC) From: Sam Leffler <sam@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r187253 - head/sbin/ifconfig Message-ID: <200901142255.n0EMtnpt056373@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901142255.n0EMtnpt056373>