diff options
Diffstat (limited to 'tools/libxl/libxl.c')
-rw-r--r-- | tools/libxl/libxl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 73f155c700..902f28236b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1724,6 +1724,7 @@ static unsigned int libxl_append_disk_list_of_type(libxl_ctx *ctx, libxl__xs_get_dompath(&gc, 0), type, domid); dir = libxl__xs_directory(&gc, XBT_NULL, be_path, &n); if (dir) { + char *removable; *disks = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n)); pdisk = *disks + *ndisks; *ndisks += n; @@ -1742,7 +1743,11 @@ static unsigned int libxl_append_disk_list_of_type(libxl_ctx *ctx, libxl__sprintf(&gc, "%s/%s/type", be_path, *dir)), &(pdisk->backend)); pdisk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/dev", be_path, *dir), &len); - pdisk->unpluggable = atoi(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path, *dir))); + removable = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/removable", be_path, *dir)); + if (removable) + pdisk->unpluggable = atoi(removable); + else + pdisk->unpluggable = 0; if (!strcmp(libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/%s/mode", be_path, *dir)), "w")) pdisk->readwrite = 1; else |