From owner-p4-projects@FreeBSD.ORG Fri May 1 11:28:49 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2ECC7106566B; Fri, 1 May 2009 11:28:49 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2F1A1065670 for ; Fri, 1 May 2009 11:28:48 +0000 (UTC) (envelope-from ccna.syl@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id 9CC1C8FC0A for ; Fri, 1 May 2009 11:28:48 +0000 (UTC) (envelope-from ccna.syl@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so1435244ywe.13 for ; Fri, 01 May 2009 04:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=wW12AC3mlMg/5lcrC1DBwwQEyjfMzxKIahQnv9bF3VQ=; b=XUXtmbx9OFqCCFb1Jgyyb57tELA2LCibdhrhzxDgVSwGgB0kjrZvstxM96Xtf/Ltna xhqykb/KhGuqxxVrwGaoLVh53g5jHbF6oP2uNcPIKUsn+7px2A0+A6Ee380GQOYoyVHb efg9VJ/f6DagdNcJ8Wt9UUNbthag6rZe41svc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=AZ3k9e1Oxbnv7alTuddfoDH5dAY8ethKkAspMoskpyRl0dWdmYsLDN4C5QquF63AMq mcNDX0Mdc206c71+ytfyIxQKmQgUQXIFvhpjRX5FCojV37ImTJ25dAIXiHdzXCz0Zzj/ TI/Wx4yGnoMs0kBryADvvkMqMqJ3PZuu1Vexc= MIME-Version: 1.0 Received: by 10.231.19.198 with SMTP id c6mr2225024ibb.46.1241176035128; Fri, 01 May 2009 04:07:15 -0700 (PDT) In-Reply-To: <200905011224.03899.hselasky@c2i.net> References: <200905010921.n419LL8L097778@repoman.freebsd.org> <200905011224.03899.hselasky@c2i.net> From: Sylvestre Gallon Date: Fri, 1 May 2009 11:06:55 +0000 Message-ID: <164b4c9c0905010406s46caf7f1m6fb01b1969f98d41@mail.gmail.com> To: Hans Petter Selasky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Perforce Change Reviews Subject: Re: PERFORCE change 161423 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2009 11:28:50 -0000 On Fri, May 1, 2009 at 10:24 AM, Hans Petter Selasky wrote: >> int >> libusb_get_string_descriptor_ascii(libusb_device_handle * dev, >> uint8_t desc_index, unsigned char *data, int length) >> @@ -207,6 +208,8 @@ >> return (LIBUSB20_ERROR_NO_MEM); >> >> pdev = dev->os_priv; >> - return (libusb20_dev_req_string_simple_sync(pdev, desc_index, >> - data, length)); >> + if (libusb20_dev_req_string_simple_sync(pdev, desc_index, >> + data, length) == 0) >> + return (length); >> + return (LIBUSB_ERROR_OTHER); >> } > > I think the correct here is to return strlen(data) in the successful case, > because it is quite common that the software will pass in a fixed size > buffer, while the actual string will be shorter. > > In other words you will get a short terminated control request on the USB. > I will add your fix with my next submit. Thanks, -- Sylvestre Gallon (http://devsyl.blogspot.com) Fifth Grade Student @ Epitech & Researcher @ LSE R&D @ Rathaxes (http://www.rathaxes.org)