projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: relayd: create_index_file error handling
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
view.c
diff --git
a/src/bin/lttng/commands/view.c
b/src/bin/lttng/commands/view.c
index c9a5fdc3e09b0f356096a25a051c55d730ea86c8..0325e505c505fab3dab2bc666fa7caec40822aa4 100644
(file)
--- a/
src/bin/lttng/commands/view.c
+++ b/
src/bin/lttng/commands/view.c
@@
-302,6
+302,7
@@
static int view_trace(void)
int ret;
char *session_name, *trace_path = NULL;
struct lttng_session *sessions = NULL;
int ret;
char *session_name, *trace_path = NULL;
struct lttng_session *sessions = NULL;
+ bool free_trace_path = false;
/*
* Safety net. If lttng is suid at some point for *any* useless reasons,
/*
* Safety net. If lttng is suid at some point for *any* useless reasons,
@@
-379,6
+380,7
@@
static int view_trace(void)
ret = CMD_ERROR;
goto free_sessions;
}
ret = CMD_ERROR;
goto free_sessions;
}
+ free_trace_path = true;
} else {
/* Get file system session path. */
trace_path = sessions[i].path;
} else {
/* Get file system session path. */
trace_path = sessions[i].path;
@@
-396,7
+398,7
@@
static int view_trace(void)
}
free_sessions:
}
free_sessions:
- if (session_live_mode) {
+ if (session_live_mode
&& free_trace_path
) {
free(trace_path);
}
free(sessions);
free(trace_path);
}
free(sessions);
@@
-415,6
+417,7
@@
int cmd_view(int argc, const char **argv)
{
int opt, ret = CMD_SUCCESS;
static poptContext pc;
{
int opt, ret = CMD_SUCCESS;
static poptContext pc;
+ const char *leftover = NULL;
pc = poptGetContext(NULL, argc, argv, long_options, 0);
poptReadDefaultConfig(pc, 0);
pc = poptGetContext(NULL, argc, argv, long_options, 0);
poptReadDefaultConfig(pc, 0);
@@
-439,6
+442,13
@@
int cmd_view(int argc, const char **argv)
opt_session_name = (char*) poptGetArg(pc);
opt_session_name = (char*) poptGetArg(pc);
+ leftover = poptGetArg(pc);
+ if (leftover) {
+ ERR("Unknown argument: %s", leftover);
+ ret = CMD_ERROR;
+ goto end;
+ }
+
ret = view_trace();
end:
ret = view_trace();
end:
This page took
0.025905 seconds
and
4
git commands to generate.