Skip to contentSkip to conversation

bind_usbintf: do not reuse 'path'

PATCH In review Chunyan Liu 2 participants 2 messages Apr 8, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bind_usbintf: do not reuse 'path'

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

CC Simon Cao <[email protected]>
CC George Dunlap <[email protected]>
CC Ian Jackson <[email protected]>
---
 tools/libxl/libxl_pvusb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
tools/libxl/libxl_pvusb.c +7 -7
index 6447639..4c1967d 100644
@@ -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;
     }
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v2 1/1
#1 lore raw

Chunyan Liu writes ("[PATCH V2] bind_usbintf: do not reuse 'path'"):

Quoted 7 lines

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

CC Simon Cao <[email protected]>
CC George Dunlap <[email protected]>
CC Ian Jackson <[email protected]>

And queued, thanks.

Again: I added `libxl: ' to the start of the patch title. I also added the CID.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel