From 0c687325f18ccb6950cd6a8a9665f33a6890d5a1 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Tue, 20 Mar 2012 11:19:14 -0400 Subject: [PATCH] Fix: lttng view, error message and exit code lttng view is a frontend command, when the viewer is not found in the path, the error message should be human readable (no need for the developper-oriented debug message). Also the return code must indicate that something went wrong if the viewer is not on the system. (fix #144) Signed-off-by: Julien Desfossez Signed-off-by: David Goulet --- src/bin/lttng/commands/view.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index 9e7c9d91e..9508743e6 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -258,7 +258,11 @@ static int spawn_viewer(const char *trace_path) ret = execvp(viewer_bin, argv); if (ret) { - PERROR("exec: %s", viewer_bin); + if (errno == ENOENT) { + ERR("%s not found on the system", viewer_bin); + } else { + PERROR("exec: %s", viewer_bin); + } free(argv); ret = CMD_FATAL; goto error; @@ -346,8 +350,6 @@ static int view_trace(void) goto free_sessions; } - ret = CMD_SUCCESS; - free_sessions: if (sessions) { free(sessions); -- 2.34.1