X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=318896559ffeab50a9a19ab4892471a27c6c86c0;hb=5a510c9fc5ac8b5292a497192bd47aeec07112e3;hp=e3ff4f1bac7d422f911e0f53e125060bb4b30137;hpb=5cdb6027a2b78fd93aa7f61174625190b5fc3459;p=lttng-tools.git diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index e3ff4f1ba..318896559 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -110,7 +110,7 @@ static void usage(FILE *ofp) static char *get_cmdline_by_pid(pid_t pid) { int ret; - FILE *fp; + FILE *fp = NULL; char *cmdline = NULL; char path[20]; /* Can't go bigger than /proc/65535/cmdline */ @@ -130,9 +130,11 @@ static char *get_cmdline_by_pid(pid_t pid) if (ret < 0) { perror("fread proc list"); } - fclose(fp); end: + if (fp) { + fclose(fp); + } return cmdline; } @@ -1251,7 +1253,6 @@ static int list_sessions(const char *session_name) /* Pretty print */ if (count == 0) { MSG("Currently no available tracing session"); - ret = CMD_ERROR; goto end; } @@ -1278,7 +1279,6 @@ static int list_sessions(const char *session_name) MSG("%sTrace path: %s", indent4, sessions[i].path); MSG("%sLive timer interval (usec): %u\n", indent4, sessions[i].live_timer_interval); - break; } } @@ -1464,7 +1464,7 @@ int cmd_list(int argc, const char **argv) } else if (opt_jul) { DBG2("Listing JUL domain"); domain.type = LTTNG_DOMAIN_JUL; - } else if (opt_jul) { + } else if (opt_log4j) { domain.type = LTTNG_DOMAIN_LOG4J; }