# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1307285721 -7200
# Node ID be4b078e2d083be51f4ae7d73434750a6ba14915
# Parent e606d167fc00de40685c52618c33a54f7a445825
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>
xen-unstable changest: 23607:2f63562df1c4
Backport-requested-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r e606d167fc00 -r be4b078e2d08 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Sun Jun 05 16:53:03 2011 +0200
+++ b/tools/libxl/libxl.c Sun Jun 05 16:55:21 2011 +0200
@@ -1724,6 +1724,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;
@@ -1742,7 +1743,11 @@
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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|