summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-08-21 18:12:34 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-09-05 03:22:13 +0800
commitc3defd050428c14e956f56810b80cf7a1343f962 (patch)
tree9486c11f08aba86b1e0a99425fcd6639426f8c84 /fs
parent2d7ac4aa33e1fcef8319ca7a0ae587f468fa26dd (diff)
downloadbarebox-c3defd050428c14e956f56810b80cf7a1343f962.tar.gz
barebox-c3defd050428c14e956f56810b80cf7a1343f962.tar.xz
fs: open: add symlink support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/fs.c b/fs/fs.c
index dfe571af2a..5bfd7136a1 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -609,13 +609,20 @@ int open(const char *pathname, int flags, ...)
struct fs_device_d *fsdev;
struct fs_driver_d *fsdrv;
FILE *f;
- int exist_err;
+ int exist_err = 0;
struct stat s;
- char *path = normalise_path(pathname);
- char *freep = path;
+ char *path;
+ char *freep;
int ret;
- exist_err = lstat(path, &s);
+ path = realfile(pathname, &s);
+
+ if (IS_ERR(path)) {
+ exist_err = PTR_ERR(path);
+ path = normalise_path(pathname);
+ }
+
+ freep = path;
if (!exist_err && S_ISDIR(s.st_mode)) {
ret = -EISDIR;