diff options
author | Roger Pau Monne <roger.pau@citrix.com> | 2012-07-26 10:35:33 +0100 |
---|---|---|
committer | Roger Pau Monne <roger.pau@citrix.com> | 2012-07-26 10:35:33 +0100 |
commit | 38bc2d3b97d18bd59241e87b2ef33b80565aa31f (patch) | |
tree | 88a54cb00d19dc4db48652d166a7be9421f95942 | |
parent | 784528b67d0f7bfb2485f53b4424dd6d2ac72d51 (diff) | |
download | xen-38bc2d3b97d18bd59241e87b2ef33b80565aa31f.tar.gz xen-38bc2d3b97d18bd59241e87b2ef33b80565aa31f.tar.bz2 xen-38bc2d3b97d18bd59241e87b2ef33b80565aa31f.zip |
xl: main_blockdetach don't call destroy if remove succeeds
xl was calling libxl_device_disk_destroy after a successful call to
libxl_device_disk_remove, which leads to an error.
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
-rw-r--r-- | tools/libxl/xl_cmdimpl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 26fcf13f49..7f5cadc81d 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -5398,7 +5398,7 @@ int main_blocklist(int argc, char **argv) int main_blockdetach(int argc, char **argv) { - int opt; + int opt, rc = 0; libxl_device_disk disk; if ((opt = def_getopt(argc, argv, "", "block-detach", 2)) != -1) @@ -5412,11 +5412,12 @@ int main_blockdetach(int argc, char **argv) fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]); return 1; } - if (libxl_device_disk_remove(ctx, domid, &disk, 0)) { + rc = libxl_device_disk_remove(ctx, domid, &disk, 0); + if (rc) { fprintf(stderr, "libxl_device_disk_remove failed.\n"); - } else - libxl_device_disk_destroy(ctx, domid, &disk, 0); - return 0; + } + libxl_device_disk_dispose(&disk); + return rc; } static char *uptime_to_string(unsigned long time, int short_mode) |