# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1309192632 -3600
# Node ID 2f63562df1c4230492a81793dce3672f93c93d9a
# Parent cc2f376d0cd97fdb2a3d5e363f728ddd0d025bd0
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>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r cc2f376d0cd9 -r 2f63562df1c4 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Mon Jun 27 17:34:01 2011 +0100
+++ b/tools/libxl/libxl.c Mon Jun 27 17:37:12 2011 +0100
@@ -1571,6 +1571,7 @@
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;
@@ -1588,7 +1589,12 @@
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->removable = 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->removable = atoi(removable);
+ else
+ pdisk->removable = 0;
if (!strcmp(libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc,
"%s/%s/mode", be_path, *dir)), "w"))
pdisk->readwrite = 1;
else
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|