aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/lib/evsel.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/lib/evsel.c')
-rw-r--r--tools/perf/lib/evsel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/lib/evsel.c b/tools/perf/lib/evsel.c
index a8cb582e2721..5a89857b0381 100644
--- a/tools/perf/lib/evsel.c
+++ b/tools/perf/lib/evsel.c
@@ -120,7 +120,8 @@ void perf_evsel__close_fd(struct perf_evsel *evsel)
for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++)
for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) {
- close(FD(evsel, cpu, thread));
+ if (FD(evsel, cpu, thread) >= 0)
+ close(FD(evsel, cpu, thread));
FD(evsel, cpu, thread) = -1;
}
}