From f37797769d68df6530274b2b0e2d6477d756b05c Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 26 Oct 2009 19:23:17 -0200 Subject: [PATCH] --- yaml --- r: 169560 b: refs/heads/master c: 7f3bedcc93f935631d2363f23de1cc80f04fdf3e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/builtin-record.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d3e73b5a950c..f06145988a87 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fcd14b3203b538dca04a2b065c774c0b57863eec +refs/heads/master: 7f3bedcc93f935631d2363f23de1cc80f04fdf3e diff --git a/trunk/tools/perf/builtin-record.c b/trunk/tools/perf/builtin-record.c index ac5ddfff4456..9e1638cc19c8 100644 --- a/trunk/tools/perf/builtin-record.c +++ b/trunk/tools/perf/builtin-record.c @@ -206,6 +206,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full) fp = fopen(filename, "r"); if (fp == NULL) { +out_race: /* * We raced with a task exiting - just return: */ @@ -247,6 +248,9 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full) snprintf(filename, sizeof(filename), "/proc/%d/task", pid); tasks = opendir(filename); + if (tasks == NULL) + goto out_race; + while (!readdir_r(tasks, &dirent, &next) && next) { char *end; pid = strtol(dirent.d_name, &end, 10);