diff mbox

[24/26] error, trace: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)

Message ID 1474034177-17663-25-git-send-email-lvivier@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Vivier Sept. 16, 2016, 1:56 p.m. UTC
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocci

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
---
 trace/control.c | 10 +++++-----
 util/error.c    |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Eric Blake Sept. 16, 2016, 3:55 p.m. UTC | #1
On 09/16/2016 08:56 AM, Laurent Vivier wrote:
> This patch is the result of coccinelle script
> scripts/coccinelle/exit.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> ---
>  trace/control.c | 10 +++++-----
>  util/error.c    |  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)

Matching comments in error.h should be changed by this patch.
diff mbox

Patch

diff --git a/trace/control.c b/trace/control.c
index 05d85ac..b09d6f1 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -165,7 +165,7 @@  void trace_enable_events(const char *line_buf)
     if (is_help_option(line_buf)) {
         trace_list_events();
         if (cur_mon == NULL) {
-            exit(0);
+            exit(EXIT_SUCCESS);
         }
     } else {
         do_trace_enable_events(line_buf);
@@ -188,7 +188,7 @@  static void trace_init_events(const char *fname)
     fp = fopen(fname, "r");
     if (!fp) {
         error_report("%s", strerror(errno));
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     while (fgets(line_buf, sizeof(line_buf), fp)) {
         loc_set_file(fname, ++line_idx);
@@ -204,7 +204,7 @@  static void trace_init_events(const char *fname)
     if (fclose(fp) != 0) {
         loc_set_file(fname, 0);
         error_report("%s", strerror(errno));
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     loc_pop(&loc);
 }
@@ -224,7 +224,7 @@  void trace_init_file(const char *file)
     if (file) {
         fprintf(stderr, "error: -trace file=...: "
                 "option not supported by the selected tracing backends\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 #endif
 }
@@ -258,7 +258,7 @@  char *trace_opt_parse(const char *optarg)
     QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"),
                                              optarg, true);
     if (!opts) {
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     if (qemu_opt_get(opts, "enable")) {
         trace_enable_events(qemu_opt_get(opts, "enable"));
diff --git a/util/error.c b/util/error.c
index 9c40b1f..89b6e25 100644
--- a/util/error.c
+++ b/util/error.c
@@ -39,7 +39,7 @@  static void error_handle_fatal(Error **errp, Error *err)
     }
     if (errp == &error_fatal) {
         error_report_err(err);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 }