From: Kienan Stewart Date: Thu, 28 Nov 2024 20:30:53 +0000 (-0500) Subject: Clean-up: lttng-crash replace `exit()` with `return` X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=be04594c6cd9f37f68a2c4f55339fd5ebed9ecc8;p=lttng-tools.git Clean-up: lttng-crash replace `exit()` with `return` 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-crash/lttng-crash.cpp b/src/bin/lttng-crash/lttng-crash.cpp index 283bd0ec0..23d8f0213 100644 --- a/src/bin/lttng-crash/lttng-crash.cpp +++ b/src/bin/lttng-crash/lttng-crash.cpp @@ -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; }