From 6188685091c58c9772b990cf0ca6ac522f97a9d0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 13 May 2012 12:43:58 +0200 Subject: Make errno a positive value Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer --- commands/ls.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'commands/ls.c') diff --git a/commands/ls.c b/commands/ls.c index c98d2dad57..ad609f3133 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -49,7 +49,7 @@ int ls(const char *path, ulong flags) string_list_init(&sl); if (stat(path, &s)) - return errno; + return -errno; if (flags & LS_SHOWARG && s.st_mode & S_IFDIR) printf("%s:\n", path); @@ -61,7 +61,7 @@ int ls(const char *path, ulong flags) dir = opendir(path); if (!dir) - return errno; + return -errno; while ((d = readdir(dir))) { sprintf(tmp, "%s/%s", path, d->d_name); @@ -85,7 +85,7 @@ int ls(const char *path, ulong flags) dir = opendir(path); if (!dir) { - errno = -ENOENT; + errno = ENOENT; return -ENOENT; } -- cgit v1.2.3