From patchwork Thu Apr 7 11:20:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 8771191 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E8289F39A for ; Thu, 7 Apr 2016 11:24:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94D272020F for ; Thu, 7 Apr 2016 11:24:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B9D4020204 for ; Thu, 7 Apr 2016 11:24:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao805-0005hm-Fc; Thu, 07 Apr 2016 11:21:25 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ao804-0005hg-D0 for xen-devel@lists.xen.org; Thu, 07 Apr 2016 11:21:24 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 68/FF-07120-3B246075; Thu, 07 Apr 2016 11:21:23 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPLMWRWlGSWpSXmKPExsXS6fhLSnezE1u 4wa+fohZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8auu9wFpzgr5h/tYG9gvMDexcjFISSwllHi 8deVjF2MnBxsAkoSb3+tZgexRQSkJa59vswIUsQsMINR4svrDUxdjBwcwgJGEu+6c0BMFgFVi dVPuUHKeQXsJObPOsgKYksIyEmcP/6TeQIjxwJGhlWM6sWpRWWpRbrGeklFmekZJbmJmTm6hg ZmermpxcWJ6ak5iUnFesn5uZsYgR5hAIIdjB3/nA4xSnIwKYnynpViCxfiS8pPqcxILM6ILyr NSS0+xCjDwaEkwVvpCJQTLEpNT61Iy8wBhgZMWoKDR0mEdz1Imre4IDG3ODMdInWKUVFKnPcy SEIAJJFRmgfXBgvHS4yyUsK8jECHCPEUpBblZpagyr9iFOdgVBLmrQeZwpOZVwI3/RXQYiagx Rf4wRaXJCKkpBoYt0lIRqfGT4tPT5y5frub09dt//r5o40vT5+U+5XJ7rFYV3Dhr1++D2TdzR VCHp5jKSqRSP653JxL7eaNp2LfeesKJ/D4/77P4mPH8W/yLamLl/Kuf3bNTn9wb0HnMrYtm3w m8ilyLZa6aJwxRdlJR+iHw5JFkgvzY9dNuJG07OzlwvrrGunZSizFGYmGWsxFxYkA8iD9FUIC AAA= X-Env-Sender: cyliu@suse.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1460028081!8002935!1 X-Originating-IP: [137.65.250.26] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27966 invoked from network); 7 Apr 2016 11:21:23 -0000 Received: from prv3-mh.provo.novell.com (HELO prv3-mh.provo.novell.com) (137.65.250.26) by server-11.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Apr 2016 11:21:23 -0000 Received: from linux-3hvf.site (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Thu, 07 Apr 2016 05:21:11 -0600 From: Chunyan Liu To: xen-devel@lists.xen.org Date: Thu, 7 Apr 2016 19:20:49 +0800 Message-Id: <1460028049-29606-1-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 2.1.4 Cc: Simon Cao , Ian Jackson , Chunyan Liu , George Dunlap Subject: [Xen-devel] [PATCH] bind_usbintf: do not reuse 'path' X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To avoid confusion, add a new variable "intf_path" to indicate driver/interface path, let "path" indicate driver/bind path only. CID: 1358111 Signed-off-by: Chunyan Liu CC: Simon Cao CC: George Dunlap CC: Ian Jackson --- tools/libxl/libxl_pvusb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c index 6447639..8cf3ddc 100644 --- a/tools/libxl/libxl_pvusb.c +++ b/tools/libxl/libxl_pvusb.c @@ -1035,18 +1035,18 @@ out: static int bind_usbintf(libxl__gc *gc, const char *intf, const char *drvpath) { - char *path; + char *path, *intf_path; struct stat st; int fd = -1; int rc, r; - path = GCSPRINTF("%s/%s", drvpath, intf); + intf_path = GCSPRINTF("%s/%s", drvpath, intf); /* check through lstat, if intf already exists under drvpath, * it's already bound, return directly; if it doesn't exist, * continue to do bind work; otherwise, return error. */ - r = lstat(path, &st); + r = lstat(intf_path, &st); if (r == 0) return 0; if (r < 0 && errno != ENOENT)