Fix: change perror to PERROR in kernel consumer
[lttng-tools.git] / src / bin / lttng / commands / list.c
index 9cc6e474773428b4d87130129604e86fa36d49e3..318896559ffeab50a9a19ab4892471a27c6c86c0 100644 (file)
@@ -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;
 }
 
@@ -1277,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;
                        }
                }
 
This page took 0.024428 seconds and 5 git commands to generate.