From mboxrd@z Thu Jan 1 00:00:00 1970 From: anthony.perard@citrix.com Subject: [PATCH v1.3 2/5] libxl: strdup disk path before put it in qemu args array. Date: Fri, 10 Dec 2010 16:59:46 +0000 Message-ID: <1292000386-32381-1-git-send-email-anthony.perard@citrix.com> References: Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Devel Cc: anthony.perard@citrix.com List-Id: xen-devel@lists.xenproject.org From: Anthony PERARD In libxl_build_device_model_args_new, the path to the disk image are freeed before there was actually use to make the arguments list of Qemu. The patch strdups it. Also it changes argv[0] of the device model from "qemu-system-xen" to "qemu-dm". --- tools/libxl/libxl.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 0feb93f..0f6e632 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1256,9 +1256,9 @@ static char ** libxl_build_device_model_args_new(libxl__gc *gc, if (!dm_args) return NULL; - flexarray_set(dm_args, num++, "qemu-system-xen"); - flexarray_set(dm_args, num++, "-xen-domid"); + flexarray_set(dm_args, num++, libxl__strdup(gc, info->device_model)); + flexarray_set(dm_args, num++, "-xen-domid"); flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->domid)); if (info->dom_name) { @@ -1378,10 +1378,10 @@ static char ** libxl_build_device_model_args_new(libxl__gc *gc, for (i; i < nb; i++) { if ( disks[i].is_cdrom ) { flexarray_set(dm_args, num++, "-cdrom"); - flexarray_set(dm_args, num++, disks[i].physpath); - }else{ + flexarray_set(dm_args, num++, libxl__strdup(gc, disks[i].physpath)); + } else { flexarray_set(dm_args, num++, libxl__sprintf(gc, "-%s", disks[i].virtpath)); - flexarray_set(dm_args, num++, disks[i].physpath); + flexarray_set(dm_args, num++, libxl__strdup(gc, disks[i].physpath)); } libxl_device_disk_destroy(&disks[i]); } -- 1.7.1