summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-03-16 09:00:36 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-04 15:02:40 +0200
commit019e12210d2f464f18766f9661329a4430467b62 (patch)
tree1818bd61138705f3c723059aca8471ac97831c12 /fs
parentc8df17c05f38b94040ca0c607ef1d24f2b489c76 (diff)
downloadbarebox-019e12210d2f464f18766f9661329a4430467b62.tar.gz
barebox-019e12210d2f464f18766f9661329a4430467b62.tar.xz
fs: errno should be set correctly before the end of functions
Otherwise we end up with errno not being set correctly if a filesystem driver uses the standard open/close/read/write functions to access its backing store. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 2f619295a9..f684d45583 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -292,8 +292,6 @@ static int path_check_prereq(const char *path, unsigned int flags)
struct stat s;
unsigned int m;
- errno = 0;
-
if (stat(path, &s)) {
if (flags & S_UB_DOES_NOT_EXIST)
return 0;
@@ -325,6 +323,8 @@ static int path_check_prereq(const char *path, unsigned int flags)
errno = -ENOTDIR;
goto out;
}
+
+ errno = 0;
out:
return errno;
}
@@ -800,6 +800,7 @@ int mount(const char *device, const char *fsname, const char *_path)
e = e->next;
e->next = entry;
}
+ errno = 0;
out:
free(path);
return errno;