Fix: lttng view, error message and exit code
authorJulien Desfossez <julien.desfossez@efficios.com>
Tue, 20 Mar 2012 15:19:14 +0000 (11:19 -0400)
committerDavid Goulet <dgoulet@ev0ke.net>
Tue, 20 Mar 2012 18:39:58 +0000 (14:39 -0400)
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 <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
src/bin/lttng/commands/view.c

index 9e7c9d91e55d8127e4e09d43169dd35dc14cfaa7..9508743e62878ade2428905ba0bfdc9e831537f5 100644 (file)
@@ -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);
This page took 0.02556 seconds and 4 git commands to generate.