All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chunyan Liu <cyliu@suse.com>
To: xen-devel@lists.xen.org
Cc: Simon Cao <caobosimon@gmail.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Chunyan Liu <cyliu@suse.com>,
	George Dunlap <george.dunlap@citrix.com>
Subject: [PATCH V2] bind_usbintf: do not reuse 'path'
Date: Fri,  8 Apr 2016 12:12:27 +0800	[thread overview]
Message-ID: <1460088747-30689-1-git-send-email-cyliu@suse.com> (raw)

To avoid confusion, use "intf_path" to indicate driver/interface path,
and "bind_path" indicate driver/bind path.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxl_pvusb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
index 6447639..4c1967d 100644
--- a/tools/libxl/libxl_pvusb.c
+++ b/tools/libxl/libxl_pvusb.c
@@ -1035,33 +1035,33 @@ out:
 
 static int bind_usbintf(libxl__gc *gc, const char *intf, const char *drvpath)
 {
-    char *path;
+    char *bind_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)
         return ERROR_FAIL;
 
-    path = GCSPRINTF("%s/bind", drvpath);
+    bind_path = GCSPRINTF("%s/bind", drvpath);
 
-    fd = open(path, O_WRONLY);
+    fd = open(bind_path, O_WRONLY);
     if (fd < 0) {
-        LOGE(ERROR, "open file failed: '%s'", path);
+        LOGE(ERROR, "open file failed: '%s'", bind_path);
         rc = ERROR_FAIL;
         goto out;
     }
 
-    if (libxl_write_exactly(CTX, fd, intf, strlen(intf), path, intf)) {
+    if (libxl_write_exactly(CTX, fd, intf, strlen(intf), bind_path, intf)) {
         rc = ERROR_FAIL;
         goto out;
     }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2016-04-08  4:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  4:12 Chunyan Liu [this message]
2016-04-08 13:36 ` [PATCH V2] bind_usbintf: do not reuse 'path' Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460088747-30689-1-git-send-email-cyliu@suse.com \
    --to=cyliu@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=caobosimon@gmail.com \
    --cc=george.dunlap@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.