From: Stefano Stabellini Date: Mon, 9 Aug 2010 16:07:50 +0000 (+0100) Subject: xl: tell the user about non-existent domains X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11676 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8b3be172a3f225539a807711318c23001e84f359;p=xen.git xl: tell the user about non-existent domains The error message when one wants to list a non-existent domain is at best misleading (libxl_domain_info failed (code -5)). This patch catches this specific error and tells the user that the requested domain does not exist: Error: Domain '42' does not exist. Signed-off-by: Andre Przywara Signed-off-by: Stefano Stabellini --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index e42ad69cbe..a2ccfe2c16 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3003,6 +3003,11 @@ int main_list(int argc, char **argv) } else if (optind == argc-1) { find_domain(argv[optind]); rc = libxl_domain_info(&ctx, &info_buf, domid); + if (rc == ERROR_INVAL) { + fprintf(stderr, "Error: Domain \'%s\' does not exist.\n", + argv[optind]); + return -rc; + } if (rc) { fprintf(stderr, "libxl_domain_info failed (code %d).\n", rc); return -rc;