Commit db724e2c authored by Mark Drayton's avatar Mark Drayton

Fix nits for /tmp/perf-pid.map support

parent 6862875c
...@@ -33,12 +33,13 @@ int bcc_perf_map_nspid(int pid) { ...@@ -33,12 +33,13 @@ int bcc_perf_map_nspid(int pid) {
// return the original PID if the NSpid line is missing // return the original PID if the NSpid line is missing
int nspid = pid; int nspid = pid;
size_t size; size_t size = 0;
char *line = NULL; char *line = NULL;
while (getline(&line, &size, status) != -1) while (getline(&line, &size, status) != -1) {
if (strstr(line, "NSpid:") != NULL) if (strstr(line, "NSpid:") != NULL)
// PID namespaces can be nested -- last number is innermost PID // PID namespaces can be nested -- last number is innermost PID
nspid = (int)strtol(strrchr(line, '\t'), NULL, 10); nspid = (int)strtol(strrchr(line, '\t'), NULL, 10);
}
free(line); free(line);
return nspid; return nspid;
...@@ -70,7 +71,7 @@ int bcc_perf_map_foreach_sym(const char *path, bcc_perf_map_symcb callback, ...@@ -70,7 +71,7 @@ int bcc_perf_map_foreach_sym(const char *path, bcc_perf_map_symcb callback,
return -1; return -1;
char *line = NULL; char *line = NULL;
size_t size; size_t size = 0;
long long begin, len; long long begin, len;
while (getline(&line, &size, file) != -1) { while (getline(&line, &size, file) != -1) {
char *cursor = line; char *cursor = line;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment