[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 06/10] xl_cmdimpl: improve return codes for cd-insert commands
- Use EXIT_{SUCCESS,FAILURE} for main_cd*() function - Use 0/1 as return values of cd_insert function Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 31f037f..2232a1e 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3471,16 +3471,16 @@ static int cd_insert(uint32_t domid, const char *virtdev, char *phys) && stat(disk.pdev_path, &b)) { fprintf(stderr, "Cannot stat file: %s\n", disk.pdev_path); - r = EXIT_FAILURE; + r = 1; goto out; } if (libxl_cdrom_insert(ctx, domid, &disk, NULL)) { - r = EXIT_FAILURE; + r = 1; goto out; } - r = EXIT_SUCCESS; + r = 0; out: libxl_device_disk_dispose(&disk); @@ -3502,7 +3502,11 @@ int main_cd_eject(int argc, char **argv) domid = find_domain(argv[optind]); virtdev = argv[optind + 1]; - return cd_insert(domid, virtdev, NULL); + if (cd_insert(domid, virtdev, NULL)) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } int main_cd_insert(int argc, char **argv) @@ -3520,7 +3524,11 @@ int main_cd_insert(int argc, char **argv) virtdev = argv[optind + 1]; file = argv[optind + 2]; - return cd_insert(domid, virtdev, file); + if (cd_insert(domid, virtdev, file)) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } int main_usbctrl_attach(int argc, char **argv) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |