[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 9/9 v2] xl: Improve return and exit codes of domain id and name related functions.



find_domain(), main_domid() and main_domname() are fixed.

Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
---
v2: Add find_domain().
---
 tools/libxl/xl_cmdimpl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 4b2ae68..883589b 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -172,7 +172,7 @@ static uint32_t find_domain(const char *p)
     rc = libxl_domain_qualifier_to_domid(ctx, p, &domid);
     if (rc) {
         fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc);
-        exit(2);
+        exit(EXIT_FAILURE);
     }
     common_domname = libxl_domid_to_name(ctx, domid);
     return domid;
@@ -6335,12 +6335,12 @@ int main_domid(int argc, char **argv)
 
     if (libxl_name_to_domid(ctx, domname, &domid)) {
         fprintf(stderr, "Can't get domid of domain name '%s', maybe this 
domain does not exist.\n", domname);
-        return 1;
+        return EXIT_FAILURE;
     }
 
     printf("%d\n", domid);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_domname(int argc, char **argv)
@@ -6358,19 +6358,19 @@ int main_domname(int argc, char **argv)
     if (domid == 0 && !strcmp(endptr, argv[optind])) {
         /*no digits at all*/
         fprintf(stderr, "Invalid domain id.\n\n");
-        return 1;
+        return EXIT_FAILURE;
     }
 
     domname = libxl_domid_to_name(ctx, domid);
     if (!domname) {
         fprintf(stderr, "Can't get domain name of domain id '%d', maybe this 
domain does not exist.\n", domid);
-        return 1;
+        return EXIT_FAILURE;
     }
 
     printf("%s\n", domname);
     free(domname);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_rename(int argc, char **argv)
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.