From: Francis Deslauriers Date: Fri, 3 Apr 2020 18:57:55 +0000 (-0400) Subject: lttng-crash: use `spawn_viewer()` to launch trace viewer X-Git-Tag: v2.12.0~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f69517b50e4d277295a0deb60d34c56ee2802665;p=lttng-tools.git lttng-crash: use `spawn_viewer()` to launch trace viewer Signed-off-by: Francis Deslauriers Change-Id: I59f8d6c1189b3b3b4cfd0704ff2c8eb22e6df44f Signed-off-by: Jérémie Galarneau --- 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; }