X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Flist.c;h=a91d30757e1b9bdbd698a317aa93d286c778a038;hb=d2243cc136eada1b871f4767b65c4d56c98ed6ad;hp=8c1d5af87fd25bfb638aa946fdd13a771afe4a6c;hpb=ff94328ff1538f1da009e81a27bbd922ef031727;p=lttng-tools.git diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 8c1d5af87..a91d30757 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -107,7 +107,7 @@ static char *get_cmdline_by_pid(pid_t pid) int ret; FILE *fp; char *cmdline = NULL; - char path[24]; /* Can't go bigger than /proc/65535/cmdline */ + char path[20]; /* Can't go bigger than /proc/65535/cmdline */ snprintf(path, sizeof(path), "/proc/%d/cmdline", pid); fp = fopen(path, "r"); @@ -117,6 +117,10 @@ static char *get_cmdline_by_pid(pid_t pid) /* Caller must free() *cmdline */ cmdline = malloc(PATH_MAX); + if (!cmdline) { + perror("malloc cmdline"); + goto end; + } ret = fread(cmdline, 1, PATH_MAX, fp); if (ret < 0) { perror("fread proc list"); @@ -716,7 +720,7 @@ static int list_channels(const char *channel_name) goto error_channels; } - if (channel_name == NULL) { + if (count) { MSG("Channels:\n-------------"); }