[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5 of 5] libxl: Do not SEGV when no 'removable' disk parameter in xenstore
# HG changeset patch # User Marek Marczykowski <marmarek@xxxxxxxxxxxx> # Date 1307285721 -7200 # Node ID fed2015fe1745e5e712380960cc50a71629698fc # Parent b77de60c85431593d439f2c4ac46023c6f8e5ee2 libxl: Do not SEGV when no 'removable' disk parameter in xenstore Just assume disk as not removable when no 'removable' paremeter Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1724,6 +1724,7 @@ static unsigned int libxl_append_disk_li 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_li 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |