From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from 3.mo2.mail-out.ovh.net ([46.105.58.226] helo=mo2.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T8z8O-00082Z-Dz for barebox@lists.infradead.org; Tue, 04 Sep 2012 19:50:05 +0000 Received: from mail21.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo2.mail-out.ovh.net (Postfix) with SMTP id F3E59DC5AF2 for ; Tue, 4 Sep 2012 21:55:20 +0200 (CEST) From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 4 Sep 2012 21:50:04 +0200 Message-Id: <1346788217-16042-6-git-send-email-plagnioj@jcrosoft.com> In-Reply-To: <1346788217-16042-1-git-send-email-plagnioj@jcrosoft.com> References: <20120904194720.GB32603@game.jcrosoft.org> <1346788217-16042-1-git-send-email-plagnioj@jcrosoft.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 06/19] fs: open: add symlink support To: barebox@lists.infradead.org Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- fs/fs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/fs.c b/fs/fs.c index dfe571a..5bfd713 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; -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox