diff mbox

[4/9,v2] xl: Improve return and exit codes of console, vnc and core dump related functions.

Message ID 1457463730-4712-5-git-send-email-write.harmandeep@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Harmandeep Kaur March 8, 2016, 7:02 p.m. UTC
autoconnect_vncviewer(), main_console(), main_vncviewer(),
core_dump_domain() and main_dump_core() in the file
xl_cmdimpl are fixed.

Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
---
v2: Add autoconnect_vncviewer().
---
 tools/libxl/xl_cmdimpl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 9ec3b2a..5cedfe8 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -219,7 +219,7 @@  static void autoconnect_vncviewer(uint32_t domid, int autopass)
 
     sleep(1);
     vncviewer(domid, autopass);
-    _exit(1);
+    _exit(EXIT_FAILURE);
 }
 
 static int acquire_lock(void)
@@ -3430,7 +3430,7 @@  int main_console(int argc, char **argv)
             type = LIBXL_CONSOLE_TYPE_SERIAL;
         else {
             fprintf(stderr, "console type supported are: pv, serial\n");
-            return 2;
+            return EXIT_FAILURE;
         }
         break;
     case 'n':
@@ -3444,7 +3444,7 @@  int main_console(int argc, char **argv)
     else
         libxl_console_exec(ctx, domid, num, type);
     fprintf(stderr, "Unable to attach console\n");
-    return 1;
+    return EXIT_FAILURE;
 }
 
 int main_vncviewer(int argc, char **argv)
@@ -3466,8 +3466,8 @@  int main_vncviewer(int argc, char **argv)
     domid = find_domain(argv[optind]);
 
     if (vncviewer(domid, autopass))
-        return 1;
-    return 0;
+        return EXIT_FAILURE;
+    return EXIT_SUCCESS;
 }
 
 static void pcilist(uint32_t domid)
@@ -4022,7 +4022,7 @@  static void core_dump_domain(uint32_t domid, const char *filename)
     int rc;
 
     rc=libxl_domain_core_dump(ctx, domid, filename, NULL);
-    if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(-1); }
+    if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(EXIT_FAILURE); }
 }
 
 #ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
@@ -4789,7 +4789,7 @@  int main_dump_core(int argc, char **argv)
     }
 
     core_dump_domain(find_domain(argv[optind]), argv[optind + 1]);
-    return 0;
+    return EXIT_SUCCESS;
 }
 
 int main_pause(int argc, char **argv)