projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Unhandled domain option condition in list_agent_events
[lttng-tools.git]
/
src
/
bin
/
lttng
/
commands
/
list.c
diff --git
a/src/bin/lttng/commands/list.c
b/src/bin/lttng/commands/list.c
index b436777d671b74bb2165d97eae9a5e6a1c6604e7..cc776dd427dcc5e30bce41d430f26c1a6ac77fcd 100644
(file)
--- a/
src/bin/lttng/commands/list.c
+++ b/
src/bin/lttng/commands/list.c
@@
-25,6
+25,7
@@
#include <assert.h>
#include <common/mi-lttng.h>
#include <assert.h>
#include <common/mi-lttng.h>
+#include <lttng/constant.h>
#include "../command.h"
#include "../command.h"
@@
-106,7
+107,8
@@
static char *get_cmdline_by_pid(pid_t pid)
int ret;
FILE *fp = NULL;
char *cmdline = NULL;
int ret;
FILE *fp = NULL;
char *cmdline = NULL;
- char path[20]; /* Can't go bigger than /proc/65535/cmdline */
+ /* Can't go bigger than /proc/LTTNG_MAX_PID/cmdline */
+ char path[sizeof("/proc//cmdline") + sizeof(LTTNG_MAX_PID_STR) - 1];
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
fp = fopen(path, "r");
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
fp = fopen(path, "r");
@@
-406,8
+408,8
@@
static int list_agent_events(void)
{
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
{
int i, size, ret = CMD_SUCCESS;
struct lttng_domain domain;
- struct lttng_handle *handle;
- struct lttng_event *event_list;
+ struct lttng_handle *handle
= NULL
;
+ struct lttng_event *event_list
= NULL
;
pid_t cur_pid = 0;
char *cmdline = NULL;
const char *agent_domain_str;
pid_t cur_pid = 0;
char *cmdline = NULL;
const char *agent_domain_str;
@@
-419,6
+421,10
@@
static int list_agent_events(void)
domain.type = LTTNG_DOMAIN_LOG4J;
} else if (opt_python) {
domain.type = LTTNG_DOMAIN_PYTHON;
domain.type = LTTNG_DOMAIN_LOG4J;
} else if (opt_python) {
domain.type = LTTNG_DOMAIN_PYTHON;
+ } else {
+ ERR("Invalid agent domain selected.");
+ ret = CMD_ERROR;
+ goto error;
}
agent_domain_str = get_domain_str(domain.type);
}
agent_domain_str = get_domain_str(domain.type);
This page took
0.026031 seconds
and
4
git commands to generate.