Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jul 2012 02:57:33 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238361 - head/sys/dev/usb
Message-ID:  <201207110257.q6B2vXeW018145@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Wed Jul 11 02:57:32 2012
New Revision: 238361
URL: http://svn.freebsd.org/changeset/base/238361

Log:
  Merge from r234532:
  
  - Fix an ifname matching issue which prevented "ifconfig wlan0 create" from
    working.
  - Return non-zero status when unit < 0.
  
  Spotted by:	dhw

Modified:
  head/sys/dev/usb/usb_pf.c

Modified: head/sys/dev/usb/usb_pf.c
==============================================================================
--- head/sys/dev/usb/usb_pf.c	Wed Jul 11 02:57:19 2012	(r238360)
+++ head/sys/dev/usb/usb_pf.c	Wed Jul 11 02:57:32 2012	(r238361)
@@ -129,7 +129,7 @@ usbpf_ifname2ubus(const char *ifname)
 	int unit;
 	int error;
 
-	if (strncmp(ifname, USBUSNAME, sizeof(USBUSNAME)) <= 0)
+	if (strncmp(ifname, USBUSNAME, sizeof(USBUSNAME) - 1) != 0)
 		return (NULL);
 	error = ifc_name2unit(ifname, &unit);
 	if (error || unit < 0)
@@ -167,8 +167,10 @@ usbpf_clone_create(struct if_clone *ifc,
 	struct usb_bus *ubus;
 
 	error = ifc_name2unit(name, &unit);
-	if (error || unit < 0)
+	if (error)
 		return (error);
+ 	if (unit < 0)
+		return (EINVAL);
 
 	ubus = usbpf_ifname2ubus(name);
 	if (ubus == NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207110257.q6B2vXeW018145>