projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: lttng: poptGetArg doesn't provide string ownership
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
help.cpp
diff --git
a/src/bin/lttng/commands/help.cpp
b/src/bin/lttng/commands/help.cpp
index 74b64964443aa184eb8ac7762491f4cac2e37037..9822b47eb90b0e5cf0e7eb940f4a04fa458a64ba 100644
(file)
--- a/
src/bin/lttng/commands/help.cpp
+++ b/
src/bin/lttng/commands/help.cpp
@@
-46,7
+46,7
@@
static struct poptOption long_options[] = {
int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
{
int opt, ret = CMD_SUCCESS;
int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
{
int opt, ret = CMD_SUCCESS;
- c
har *
cmd_name;
+ c
onst char *arg_
cmd_name;
static poptContext pc;
const struct cmd_struct *cmd;
int found = 0;
static poptContext pc;
const struct cmd_struct *cmd;
int found = 0;
@@
-70,9
+70,8
@@
int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
}
/* Get command name */
}
/* Get command name */
- cmd_name = (char *) poptGetArg(pc);
-
- if (cmd_name == NULL) {
+ arg_cmd_name = poptGetArg(pc);
+ if (arg_cmd_name == NULL) {
/* Fall back to lttng(1) */
ret = utils_show_help(1, "lttng", lttng_help_msg);
if (ret) {
/* Fall back to lttng(1) */
ret = utils_show_help(1, "lttng", lttng_help_msg);
if (ret) {
@@
-85,7
+84,7
@@
int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
}
/* Help about help? */
}
/* Help about help? */
- if (strcmp(cmd_name, "help") == 0) {
+ if (strcmp(
arg_
cmd_name, "help") == 0) {
SHOW_HELP();
goto end;
}
SHOW_HELP();
goto end;
}
@@
-94,7
+93,7
@@
int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
cmd = &commands[0];
while (cmd->name != NULL) {
cmd = &commands[0];
while (cmd->name != NULL) {
- if (strcmp(cmd->name, cmd_name) == 0) {
+ if (strcmp(cmd->name,
arg_
cmd_name) == 0) {
found = 1;
break;
}
found = 1;
break;
}
@@
-103,7
+102,7
@@
int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
}
if (!found) {
}
if (!found) {
- ERR("Unknown command \"%s\"", cmd_name);
+ ERR("Unknown command \"%s\"",
arg_
cmd_name);
ret = CMD_ERROR;
goto end;
}
ret = CMD_ERROR;
goto end;
}
This page took
0.02566 seconds
and
4
git commands to generate.