diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2011-10-18 13:48:44 +0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-10-18 12:12:43 +0200 |
commit | 74c36329c3531acf59d76a09cd0c4cf11ce6b6a0 (patch) | |
tree | dd8218c4c6c7c97d34da1e7a06eda4e88f1838aa /fs | |
parent | 3808cb7a451a032c9181e6b3ed3f88b62eb46ee7 (diff) | |
download | barebox-74c36329c3531acf59d76a09cd0c4cf11ce6b6a0.tar.gz barebox-74c36329c3531acf59d76a09cd0c4cf11ce6b6a0.tar.xz |
fs: fix path_check_prereq()
This patch makes impossible the situations than path_check_prereq() can make
'return 0' without changing errno.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -293,9 +293,11 @@ 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; + goto out; errno = -ENOENT; goto out; } @@ -306,7 +308,7 @@ static int path_check_prereq(const char *path, unsigned int flags) } if (flags == S_UB_EXISTS) - return 0; + goto out; m = s.st_mode; @@ -325,7 +327,6 @@ static int path_check_prereq(const char *path, unsigned int flags) goto out; } - errno = 0; out: return errno; } |