9
0
Fork 0

fs: open: add symlink support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-08-21 18:12:34 +08:00
parent 2d7ac4aa33
commit c3defd0504
1 changed files with 11 additions and 4 deletions

15
fs/fs.c
View File

@ -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;