[PATCH 10/13] perf tools: Fix lsdir to set errno correctly

From: Arnaldo Carvalho de Melo
Date: Wed May 11 2016 - 12:37:25 EST


From: Masami Hiramatsu <mhiramat@xxxxxxxxxx>

Fix lsdir() to set correct positive error number (ENOMEM). Since
"errno" must have a positive error number instead of negative number,
fix lsdir to set it correctly.

Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Ananth N Mavinakayanahalli <ananth@xxxxxxxxxxxxxxxxxx>
Cc: Brendan Gregg <brendan.d.gregg@xxxxxxxxx>
Cc: Hemant Kumar <hemant@xxxxxxxxxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Fixes: e1ce726e1db2 ("perf tools: Add lsdir() helper to read a directory")
Link: 20160511135127.23943.40644.stgit@devbox">http://lkml.kernel.org/r/20160511135127.23943.40644.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 01c9433de7ef..eab077ad6ca9 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -139,7 +139,7 @@ struct strlist *lsdir(const char *name,

list = strlist__new(NULL, NULL);
if (!list) {
- errno = -ENOMEM;
+ errno = ENOMEM;
goto out;
}

--
2.5.5