perf tools: Fix lsdir to set errno correctly
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 11 May 2016 13:51:27 +0000 (22:51 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 May 2016 16:06:05 +0000 (13:06 -0300)
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@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: e1ce726e1db2 ("perf tools: Add lsdir() helper to read a directory")
Link: http://lkml.kernel.org/r/20160511135127.23943.40644.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/util.c

index 01c9433de7ef5b53e1ce96c357e4f3d161d29af9..eab077ad6ca92f5fac2f570c3c96008203a980de 100644 (file)
@@ -139,7 +139,7 @@ struct strlist *lsdir(const char *name,
 
        list = strlist__new(NULL, NULL);
        if (!list) {
-               errno = -ENOMEM;
+               errno = ENOMEM;
                goto out;
        }