If the kernel has an extended error report for us, use it instead of
trying to guess what might have gone wrong.

Signed-off-by: Alexander Shishkin <alexander.shish...@linux.intel.com>
---
 tools/perf/util/evsel.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c53f79123b..1804781072 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -27,6 +27,7 @@
 #include "debug.h"
 #include "trace-event.h"
 #include "stat.h"
+#include "exterr.h"
 
 static struct {
        bool sample_id_all;
@@ -2266,7 +2267,16 @@ bool perf_evsel__fallback(struct perf_evsel *evsel, int 
err,
 int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
                              int err, char *msg, size_t size)
 {
-       char sbuf[STRERR_BUFSIZE];
+       char sbuf[BUFSIZ];
+       int ret;
+
+       ret = exterr__strerror(msg, size);
+       /*
+        * If kernel gave an extended error description, don't try to be any
+        * more helpful here.
+        */
+       if (ret > 0)
+               return ret;
 
        switch (err) {
        case EPERM:
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to