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
/
list.cpp
diff --git
a/src/bin/lttng/commands/list.cpp
b/src/bin/lttng/commands/list.cpp
index 9046c465885424160ffe63ae878c92b35ce42fa1..5f52a57f6dcd4973faad510c66461bb65c6c0d01 100644
(file)
--- a/
src/bin/lttng/commands/list.cpp
+++ b/
src/bin/lttng/commands/list.cpp
@@
-14,13
+14,13
@@
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
-#include <common/mi-lttng.h>
-#include <common/time.h>
-#include <common/tracker.h>
-#include <lttng/domain-internal.h>
+#include <common/mi-lttng.h
pp
>
+#include <common/time.h
pp
>
+#include <common/tracker.h
pp
>
+#include <lttng/domain-internal.h
pp
>
#include <lttng/lttng.h>
#include <lttng/lttng.h>
-#include "../command.h"
+#include "../command.h
pp
"
static int opt_userspace;
static int opt_kernel;
static int opt_userspace;
static int opt_kernel;
@@
-91,11
+91,12
@@
static char *get_cmdline_by_pid(pid_t pid)
}
/* Caller must free() *cmdline */
}
/* Caller must free() *cmdline */
- cmdline =
(char *) zmalloc
(PATH_MAX);
+ cmdline =
zmalloc<char>
(PATH_MAX);
if (!cmdline) {
PERROR("malloc cmdline");
goto end;
}
if (!cmdline) {
PERROR("malloc cmdline");
goto end;
}
+
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
PERROR("fread proc list");
ret = fread(cmdline, 1, PATH_MAX, fp);
if (ret < 0) {
PERROR("fread proc list");
@@
-2270,7
+2271,7
@@
end:
int cmd_list(int argc, const char **argv)
{
int opt, ret = CMD_SUCCESS;
int cmd_list(int argc, const char **argv)
{
int opt, ret = CMD_SUCCESS;
- const char *session_name, *leftover = NULL;
+ const char *
arg_
session_name, *leftover = NULL;
static poptContext pc;
struct lttng_domain domain;
struct lttng_domain *domains = NULL;
static poptContext pc;
struct lttng_domain domain;
struct lttng_domain *domains = NULL;
@@
-2329,8
+2330,8
@@
int cmd_list(int argc, const char **argv)
}
/* Get session name (trailing argument) */
}
/* Get session name (trailing argument) */
- session_name = poptGetArg(pc);
- DBG2("Session name: %s", session_name);
+
arg_
session_name = poptGetArg(pc);
+ DBG2("Session name: %s",
arg_
session_name);
leftover = poptGetArg(pc);
if (leftover) {
leftover = poptGetArg(pc);
if (leftover) {
@@
-2360,14
+2361,14
@@
int cmd_list(int argc, const char **argv)
}
if (opt_kernel || opt_userspace || opt_jul || opt_log4j || opt_python) {
}
if (opt_kernel || opt_userspace || opt_jul || opt_log4j || opt_python) {
- the_handle = lttng_create_handle(session_name, &domain);
+ the_handle = lttng_create_handle(
arg_
session_name, &domain);
if (the_handle == NULL) {
ret = CMD_FATAL;
goto end;
}
}
if (the_handle == NULL) {
ret = CMD_FATAL;
goto end;
}
}
- if (session_name == NULL) {
+ if (
arg_
session_name == NULL) {
if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j
&& !opt_python) {
ret = list_sessions(NULL);
if (!opt_kernel && !opt_userspace && !opt_jul && !opt_log4j
&& !opt_python) {
ret = list_sessions(NULL);
@@
-2415,19
+2416,19
@@
int cmd_list(int argc, const char **argv)
}
}
/* MI: the ouptut of list_sessions is an unclosed session element */
}
}
/* MI: the ouptut of list_sessions is an unclosed session element */
- ret = list_sessions(session_name);
+ ret = list_sessions(
arg_
session_name);
if (ret) {
goto end;
}
if (ret) {
goto end;
}
- ret = list_rotate_settings(session_name);
+ ret = list_rotate_settings(
arg_
session_name);
if (ret) {
goto end;
}
/* Domain listing */
if (opt_domain) {
if (ret) {
goto end;
}
/* Domain listing */
if (opt_domain) {
- ret = list_domains(session_name);
+ ret = list_domains(
arg_
session_name);
goto end;
}
goto end;
}
@@
-2478,7
+2479,7
@@
int cmd_list(int argc, const char **argv)
int i, nb_domain;
/* We want all domain(s) */
int i, nb_domain;
/* We want all domain(s) */
- nb_domain = lttng_list_domains(session_name, &domains);
+ nb_domain = lttng_list_domains(
arg_
session_name, &domains);
if (nb_domain < 0) {
ret = CMD_ERROR;
ERR("%s", lttng_strerror(nb_domain));
if (nb_domain < 0) {
ret = CMD_ERROR;
ERR("%s", lttng_strerror(nb_domain));
@@
-2533,7
+2534,7
@@
int cmd_list(int argc, const char **argv)
}
the_handle = lttng_create_handle(
}
the_handle = lttng_create_handle(
- session_name, &domains[i]);
+
arg_
session_name, &domains[i]);
if (the_handle == NULL) {
ret = CMD_FATAL;
goto end;
if (the_handle == NULL) {
ret = CMD_FATAL;
goto end;
This page took
0.036467 seconds
and
4
git commands to generate.