]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: bind_usbintf: do not reuse 'path'
authorChunyan Liu <cyliu@suse.com>
Fri, 8 Apr 2016 04:12:27 +0000 (12:12 +0800)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 8 Apr 2016 13:34:43 +0000 (14:34 +0100)
To avoid confusion, use "intf_path" to indicate driver/interface path,
and "bind_path" indicate driver/bind path.

CID: 1358111

Signed-off-by: Chunyan Liu <cyliu@suse.com>
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_pvusb.c

index 07030a4bc3410916f89f057ec05a1cb80d61e2fc..c66733bba968a389d9570f32699514b2359d1880 100644 (file)
@@ -1096,33 +1096,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;
     }