[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxenlight: avoid writing empty values to xenstore
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1259910584 0 # Node ID cabc1f9341e46fb156e4aa9184ded86adc62a700 # Parent 6b6b4a2cc98ef2fdba13329faa4319dcb9b58cb4 libxenlight: avoid writing empty values to xenstore Prevent segmentation fault caused by empty values in key-value pairs for the /vm/ subdirectory when restoring a pv domain. Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> --- tools/libxl/libxl.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff -r 6b6b4a2cc98e -r cabc1f9341e4 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Fri Dec 04 07:06:47 2009 +0000 +++ b/tools/libxl/libxl.c Fri Dec 04 07:09:44 2009 +0000 @@ -229,6 +229,7 @@ int libxl_domain_restore(struct libxl_ct libxl_device_model_info *dm_info) { char **vments = NULL, **localents = NULL; + int i; build_pre(ctx, domid, info, state); restore_common(ctx, domid, info, state, fd); @@ -240,14 +241,19 @@ int libxl_domain_restore(struct libxl_ct vments[3] = "hvm"; } else { vments = libxl_calloc(ctx, 9, sizeof(char *)); - vments[0] = "image/ostype"; - vments[1] = "linux"; - vments[2] = "image/kernel"; - vments[3] = (char*) info->kernel; - vments[4] = "image/ramdisk"; - vments[5] = (char*) info->u.pv.ramdisk; - vments[6] = "image/cmdline"; - vments[7] = (char*) info->u.pv.cmdline; + i = 0; + vments[i++] = "image/ostype"; + vments[i++] = "linux"; + vments[i++] = "image/kernel"; + vments[i++] = (char*) info->kernel; + if (info->u.pv.ramdisk) { + vments[i++] = "image/ramdisk"; + vments[i++] = (char*) info->u.pv.ramdisk; + } + if (info->u.pv.cmdline) { + vments[i++] = "image/cmdline"; + vments[i++] = (char*) info->u.pv.cmdline; + } } build_post(ctx, domid, info, state, vments, localents); if (info->hvm) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |