[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v11 16/17] 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. Changes since v10: * Return error if libxl_device_disk_remove fails. * Call libxl_device_disk_dispose unconditionally. Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> --- 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 4028f54..6df1fbd 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -5399,7 +5399,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) @@ -5413,11 +5413,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) -- 1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |