debuggers.hg

changeset 22547:cb75d32db0d6

libxl: strdup disk path before put it in qemu args array.

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.

This patch also changes argv[0] of the device model.
Now, it is the conventional argv[0], so is value come from
info->device_model.


Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/libxl/libxl.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
author Anthony PERARD <anthony.perard@citrix.com>
date Mon Dec 13 17:59:02 2010 +0000 (2010-12-13)
parents 46f5b6654436
children f57026cd5d19
files tools/libxl/libxl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Mon Dec 13 17:58:20 2010 +0000
     1.2 +++ b/tools/libxl/libxl.c	Mon Dec 13 17:59:02 2010 +0000
     1.3 @@ -1256,9 +1256,9 @@ static char ** libxl_build_device_model_
     1.4      if (!dm_args)
     1.5          return NULL;
     1.6  
     1.7 -    flexarray_set(dm_args, num++, "qemu-system-xen");
     1.8 +    flexarray_set(dm_args, num++, libxl__strdup(gc, info->device_model));
     1.9 +
    1.10      flexarray_set(dm_args, num++, "-xen-domid");
    1.11 -
    1.12      flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->domid));
    1.13  
    1.14      if (info->dom_name) {
    1.15 @@ -1378,10 +1378,10 @@ static char ** libxl_build_device_model_
    1.16      for (i; i < nb; i++) {
    1.17          if ( disks[i].is_cdrom ) {
    1.18              flexarray_set(dm_args, num++, "-cdrom");
    1.19 -            flexarray_set(dm_args, num++, disks[i].physpath);
    1.20 -        }else{
    1.21 +            flexarray_set(dm_args, num++, libxl__strdup(gc, disks[i].physpath));
    1.22 +        } else {
    1.23              flexarray_set(dm_args, num++, libxl__sprintf(gc, "-%s", disks[i].virtpath));
    1.24 -            flexarray_set(dm_args, num++, disks[i].physpath);
    1.25 +            flexarray_set(dm_args, num++, libxl__strdup(gc, disks[i].physpath));
    1.26          }
    1.27          libxl_device_disk_destroy(&disks[i]);
    1.28      }