]> git.lttng.org Git - lttng-tools.git/commitdiff
Clean-up: lttng-crash replace `exit()` with `return`
authorKienan Stewart <kstewart@efficios.com>
Thu, 28 Nov 2024 20:30:53 +0000 (15:30 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 18 Dec 2024 15:56:25 +0000 (15:56 +0000)
Use `return` to avoid running into issues in the future when using
`lttng::scope_exit` objects to perform clean-up.

Change-Id: I11d9585a2e3fb5c5453220a07c29f166016d46b9
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-crash/lttng-crash.cpp

index 283bd0ec062af722504dfdd4ed594f9fed08c99e..23d8f0213c93a91bfac9952c33388375fd15d388 100644 (file)
@@ -202,7 +202,6 @@ static void usage()
        if (ret) {
                ERR("Cannot show --help for `lttng-crash`");
                perror("exec");
-               exit(EXIT_FAILURE);
        }
 }
 
@@ -250,7 +249,7 @@ static int parse_args(int argc, char **argv)
 
        if (argc < 2) {
                usage();
-               exit(EXIT_FAILURE);
+               return -1;
        }
 
        while ((opt = getopt_long(argc, argv, "+Vhve:x:", long_options, nullptr)) != -1) {
@@ -1163,10 +1162,10 @@ static int view_trace(const char *trace_path, char *viewer_path)
 
                ret = spawn_viewer(trace_path, viewer_path, false);
                if (ret) {
-                       exit(EXIT_FAILURE);
+                       return EXIT_FAILURE;
                }
                /* Never reached */
-               exit(EXIT_SUCCESS);
+               return EXIT_SUCCESS;
        }
        return 0;
 }
@@ -1229,5 +1228,5 @@ int main(int argc, char *argv[])
                }
        }
 end:
-       exit(has_warning ? EXIT_FAILURE : EXIT_SUCCESS);
+       return has_warning ? EXIT_FAILURE : EXIT_SUCCESS;
 }
This page took 0.029761 seconds and 4 git commands to generate.