qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 04/26] block: use exit(EXIT_SUCCESS) and exit(EXIT_F


From: Laurent Vivier
Subject: [Qemu-devel] [PATCH 04/26] block: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Date: Fri, 16 Sep 2016 15:55:55 +0200

This patch is the result of coccinelle script
scripts/coccinelle/exit.cocci

Signed-off-by: Laurent Vivier <address@hidden>
CC: Max Reitz <address@hidden>
---
 hw/block/pflash_cfi01.c |  2 +-
 hw/block/tc58128.c      |  2 +-
 qemu-img.c              |  4 ++--
 qemu-io.c               | 24 ++++++++++++------------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 62d7a56..f6a7909 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -52,7 +52,7 @@
 #define PFLASH_BUG(fmt, ...) \
 do { \
     fprintf(stderr, "PFLASH: Possible BUG - " fmt, ## __VA_ARGS__); \
-    exit(1); \
+    exit(EXIT_FAILURE); \
 } while(0)
 
 /* #define PFLASH_DEBUG */
diff --git a/hw/block/tc58128.c b/hw/block/tc58128.c
index 1d9f7ee..8d7b489 100644
--- a/hw/block/tc58128.c
+++ b/hw/block/tc58128.c
@@ -41,7 +41,7 @@ static void init_dev(tc58128_dev * dev, const char *filename)
        if (ret < 0) {
             if (!qtest_enabled()) {
                 error_report("Could not load flash image %s", filename);
-                exit(1);
+                exit(EXIT_FAILURE);
             }
        } else {
            /* Build first block with number of blocks */
diff --git a/qemu-img.c b/qemu-img.c
index ea52486..ed90a21 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2418,7 +2418,7 @@ static void dump_map_entry(OutputFormat output_format, 
MapEntry *e,
     case OFORMAT_HUMAN:
         if (e->data && !e->has_offset) {
             error_report("File contains external, encrypted or compressed 
clusters.");
-            exit(1);
+            exit(EXIT_FAILURE);
         }
         if (e->data && !e->zero) {
             printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n",
@@ -3870,7 +3870,7 @@ int main(int argc, char **argv)
     optind = 0;
 
     if (!trace_init_backends()) {
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     trace_init_file(trace_file);
     qemu_set_log(LOG_TRACE);
diff --git a/qemu-io.c b/qemu-io.c
index db129ea..5b08adf 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -489,7 +489,7 @@ int main(int argc, char **argv)
         case 'd':
             if (bdrv_parse_discard_flags(optarg, &flags) < 0) {
                 error_report("Invalid discard option: %s", optarg);
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             break;
         case 'f':
@@ -510,7 +510,7 @@ int main(int argc, char **argv)
         case 't':
             if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) {
                 error_report("Invalid cache option: %s", optarg);
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             break;
         case 'T':
@@ -519,16 +519,16 @@ int main(int argc, char **argv)
             break;
         case 'V':
             printf("%s version %s\n", progname, QEMU_VERSION);
-            exit(0);
+            exit(EXIT_SUCCESS);
         case 'h':
             usage(progname);
-            exit(0);
+            exit(EXIT_SUCCESS);
         case OPTION_OBJECT: {
             QemuOpts *qopts;
             qopts = qemu_opts_parse_noisily(&qemu_object_opts,
                                             optarg, true);
             if (!qopts) {
-                exit(1);
+                exit(EXIT_FAILURE);
             }
         }   break;
         case OPTION_IMAGE_OPTS:
@@ -536,33 +536,33 @@ int main(int argc, char **argv)
             break;
         default:
             usage(progname);
-            exit(1);
+            exit(EXIT_FAILURE);
         }
     }
 
     if ((argc - optind) > 1) {
         usage(progname);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     if (format && imageOpts) {
         error_report("--image-opts and -f are mutually exclusive");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     if (qemu_init_main_loop(&local_error)) {
         error_report_err(local_error);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     if (qemu_opts_foreach(&qemu_object_opts,
                           user_creatable_add_opts_foreach,
                           NULL, NULL)) {
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     if (!trace_init_backends()) {
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     trace_init_file(trace_file);
     qemu_set_log(LOG_TRACE);
@@ -591,7 +591,7 @@ int main(int argc, char **argv)
             QemuOpts *qopts = NULL;
             qopts = qemu_opts_parse_noisily(&file_opts, argv[optind], false);
             if (!qopts) {
-                exit(1);
+                exit(EXIT_FAILURE);
             }
             opts = qemu_opts_to_qdict(qopts, NULL);
             openfile(NULL, flags, writethrough, opts);
-- 
2.5.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]