mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] fs: remove shortcut in canonicalizing filenames
Date: Mon, 16 Apr 2018 14:22:25 +0200	[thread overview]
Message-ID: <20180416122225.6302-2-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20180416122225.6302-1-u.oelmann@pengutronix.de>

Only individually getting the file status for every part of the path tells us if
a symbolic link is involved or not. If this is the case the later call to
readlink will check if the filesystem supports symbolic links or not.

Hence this reverts commit d79a81736f64 ("fs: Don't bother filesystems without
link support with additional stat() calls").

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 fs/fs.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 7c818eca024f..b2da0a62a29d 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -144,7 +144,6 @@ char *normalise_path(const char *pathname)
 EXPORT_SYMBOL(normalise_path);
 
 static int __lstat(const char *filename, struct stat *s);
-static struct fs_device_d *get_fsdevice_by_path(const char *path);
 
 static char *__canonicalize_path(const char *_pathname, int level)
 {
@@ -167,7 +166,6 @@ static char *__canonicalize_path(const char *_pathname, int level)
 		char *p = strsep(&path, "/");
 		char *tmp;
 		char link[PATH_MAX] = {};
-		struct fs_device_d *fsdev;
 
 		if (!p)
 			break;
@@ -186,14 +184,6 @@ static char *__canonicalize_path(const char *_pathname, int level)
 		free(outpath);
 		outpath = tmp;
 
-		/*
-		 * Don't bother filesystems without link support
-		 * with an additional stat() call.
-		 */
-		fsdev = get_fsdevice_by_path(outpath);
-		if (!fsdev || !fsdev->driver->readlink)
-			continue;
-
 		ret = __lstat(outpath, &s);
 		if (ret)
 			goto out;
-- 
2.16.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2018-04-16 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 12:22 [PATCH 1/2] fs: fix error path in __canonicalize_path() Ulrich Ölmann
2018-04-16 12:22 ` Ulrich Ölmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180416122225.6302-2-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox