From 53866dcb2a4f927cc421b880cf213351df31f03c Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 3 Apr 2020 14:57:55 -0400 Subject: [PATCH] lttng-crash: use `spawn_viewer()` to launch trace viewer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Francis Deslauriers Change-Id: I59f8d6c1189b3b3b4cfd0704ff2c8eb22e6df44f Signed-off-by: Jérémie Galarneau --- src/bin/lttng-crash/lttng-crash.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/bin/lttng-crash/lttng-crash.c b/src/bin/lttng-crash/lttng-crash.c index 262cd7cc0..8f94544ba 100644 --- a/src/bin/lttng-crash/lttng-crash.c +++ b/src/bin/lttng-crash/lttng-crash.c @@ -27,10 +27,9 @@ #include #include #include +#include #include -#define DEFAULT_VIEWER "babeltrace" - #define COPY_BUFLEN 4096 #define RB_CRASH_DUMP_ABI_LEN 32 @@ -295,10 +294,6 @@ static int parse_args(int argc, char **argv) } } - if (!opt_viewer_path) { - opt_viewer_path = (char *) DEFAULT_VIEWER; - } - /* No leftovers, or more than one input path, print usage and quit */ if (argc - optind != 1) { ERR("Command-line error: Specify exactly one input path"); @@ -1181,7 +1176,7 @@ end_no_closedir: } static -int view_trace(const char *viewer_path, const char *trace_path) +int view_trace(const char *trace_path, char *viewer_path) { pid_t pid; @@ -1202,13 +1197,12 @@ int view_trace(const char *viewer_path, const char *trace_path) /* Child */ int ret; - ret = execlp(viewer_path, viewer_path, - trace_path, (char *) NULL); + ret = spawn_viewer(trace_path, viewer_path, false); if (ret) { - PERROR("execlp"); exit(EXIT_FAILURE); } - exit(EXIT_SUCCESS); /* Never reached */ + /* Never reached */ + exit(EXIT_SUCCESS); } return 0; } @@ -1260,7 +1254,7 @@ int main(int argc, char *argv[]) } if (!opt_output_path) { /* View trace */ - ret = view_trace(opt_viewer_path, output_path); + ret = view_trace(output_path, opt_viewer_path); if (ret) { has_warning = true; } -- 2.34.1