[PATCH 05/18] fs: open: add symlink support
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Fri Aug 24 00:50:05 EDT 2012
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
fs/fs.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index 9f2e82c..ca6340c 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -606,13 +606,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;
--
1.7.10.4
More information about the barebox
mailing list