From owner-svn-src-stable@FreeBSD.ORG Sun Dec 20 18:57:43 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D6B81065670; Sun, 20 Dec 2009 18:57:43 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C4358FC1B; Sun, 20 Dec 2009 18:57:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKIvha1072359; Sun, 20 Dec 2009 18:57:43 GMT (envelope-from scf@svn.freebsd.org) Received: (from scf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKIvhW6072357; Sun, 20 Dec 2009 18:57:43 GMT (envelope-from scf@svn.freebsd.org) Message-Id: <200912201857.nBKIvhW6072357@svn.freebsd.org> From: Sean Farley Date: Sun, 20 Dec 2009 18:57:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200757 - stable/8/lib/libusb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 18:57:43 -0000 Author: scf Date: Sun Dec 20 18:57:43 2009 New Revision: 200757 URL: http://svn.freebsd.org/changeset/base/200757 Log: Merge from head to stable/8: r200424: Fix libusb_open_device_with_vid_pid() to return a NULL if no device is found instead of the last device in its search list. Reviewed by: thompsa Modified: stable/8/lib/libusb/libusb10.c Directory Properties: stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) Modified: stable/8/lib/libusb/libusb10.c ============================================================================== --- stable/8/lib/libusb/libusb10.c Sun Dec 20 18:53:34 2009 (r200756) +++ stable/8/lib/libusb/libusb10.c Sun Dec 20 18:57:43 2009 (r200757) @@ -379,8 +379,6 @@ libusb_open_device_with_vid_pid(libusb_c if ((i = libusb_get_device_list(ctx, &devs)) < 0) return (NULL); - pdev = NULL; - for (j = 0; j < i; j++) { pdev = devs[j]->os_priv; pdesc = libusb20_dev_get_device_desc(pdev); @@ -396,6 +394,8 @@ libusb_open_device_with_vid_pid(libusb_c break; } } + if (j == i) + pdev = NULL; libusb_free_device_list(devs, 1); DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave");