]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: Cleanup: use libxl__backendpath_parse_domid in libxl__device_disk_from_xs_be
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 29 Apr 2016 15:08:19 +0000 (16:08 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 6 Jun 2016 14:48:36 +0000 (15:48 +0100)
Rather than an open-coded sscanf.  No functional change with correct
input.

This is a followup to XSA-175 and XSA-178.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c

index 20a89605623c7cd03f9b9ea0ebda54d121bf177e..c0a80cb726bceffb6f2e83c24c9141c79f938abc 100644 (file)
@@ -2640,10 +2640,10 @@ static int libxl__device_disk_from_xenstore(libxl__gc *gc,
         goto out;
     }
 
-    rc = sscanf(backend_path, "/local/domain/%d/", &disk->backend_domid);
-    if (rc != 1) {
+    rc = libxl__backendpath_parse_domid(gc, backend_path, &disk->backend_domid);
+    if (rc) {
         LOG(ERROR, "Unable to fetch device backend domid from %s", backend_path);
-        goto cleanup;
+        goto out;
     }
 
     /* "params" may not be present; but everything else must be. */