diff options
author | Namhyung Kim <[email protected]> | 2012-02-23 12:13:36 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2012-03-05 10:15:49 -0300 |
commit | 41c21a68308f2f268a01ec1a7fa5f650e320a0f3 (patch) | |
tree | a843f5fdfeff7eda29ef3b1ea4b7b9e0836e97a8 | |
parent | 737f24bda723fdf89ecaacb99fa2bf5683c32799 (diff) |
perf evlist: Restore original errno after open failed
If perf_evsel__open() failed, the errno was set and returned properly.
However since the perf_evlist__open() called close() on fd's for all of
evsel x cpu x thread after the failure, the errno was overridden by
other code (EBADF). So the caller of the function ended up seeing
different error message and getting confused.
Fit it by restoring original return value. Because one of caller of the
function is in the python extension, and it uses system errno
internally, it'd be better restoring the original value rather than
using the return value of the function directly, IMHO (i.e. I'm not a
python expert :)
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/evlist.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index f8da9fada002..159263d17c2d 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -765,6 +765,7 @@ out_err: list_for_each_entry_reverse(evsel, &evlist->entries, node) perf_evsel__close(evsel, ncpus, nthreads); + errno = -err; return err; } |