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

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



flush_stream(), list_domains(), list_vm(), main_list() and
main_vm_list() are fixed.

Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
---
v2: No changes.
---
 tools/libxl/xl_cmdimpl.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 02aec34..4011c81 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -433,7 +433,7 @@ static void flush_stream(FILE *fh)
 
     if (ferror(fh) || fflush(fh)) {
         perror(fh_name);
-        exit(-1);
+        exit(EXIT_FAILURE);
     }
 }
 
@@ -3936,12 +3936,12 @@ static void list_domains(bool verbose, bool context, 
bool claim, bool numa,
     if (numa) {
         if (libxl_node_bitmap_alloc(ctx, &nodemap, 0)) {
             fprintf(stderr, "libxl_node_bitmap_alloc_failed.\n");
-            exit(1);
+            exit(EXIT_FAILURE);
         }
         if (libxl_get_physinfo(ctx, &physinfo) != 0) {
             fprintf(stderr, "libxl_physinfo failed.\n");
             libxl_bitmap_dispose(&nodemap);
-            exit(1);
+            exit(EXIT_FAILURE);
         }
 
         printf(" NODE Affinity");
@@ -4005,7 +4005,7 @@ static void list_vm(void)
 
     if (!info) {
         fprintf(stderr, "libxl_list_vm failed.\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     printf("UUID                                  ID    name\n");
     for (i = 0; i < nb_vm; i++) {
@@ -4959,7 +4959,7 @@ int main_list(int argc, char **argv)
         info = libxl_list_domain(ctx, &nb_domain);
         if (!info) {
             fprintf(stderr, "libxl_list_domain failed.\n");
-            return 1;
+            return EXIT_FAILURE;
         }
         info_free = info;
     } else if (optind == argc-1) {
@@ -4968,17 +4968,17 @@ int main_list(int argc, char **argv)
         if (rc == ERROR_DOMAIN_NOTFOUND) {
             fprintf(stderr, "Error: Domain \'%s\' does not exist.\n",
                 argv[optind]);
-            return -rc;
+            return EXIT_FAILURE;
         }
         if (rc) {
             fprintf(stderr, "libxl_domain_info failed (code %d).\n", rc);
-            return -rc;
+            return EXIT_FAILURE;
         }
         info = &info_buf;
         nb_domain = 1;
     } else {
         help("list");
-        return 2;
+        return EXIT_FAILURE;
     }
 
     if (details)
@@ -4992,7 +4992,7 @@ int main_list(int argc, char **argv)
 
     libxl_dominfo_dispose(&info_buf);
 
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_vm_list(int argc, char **argv)
@@ -5004,7 +5004,7 @@ int main_vm_list(int argc, char **argv)
     }
 
     list_vm();
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 static void string_realloc_append(char **accumulate, const char *more)
-- 
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®.