From: Sergei Antonov <saproj@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Vyacheslav Dubeyko <slava@dubeyko.com>,
Hin-Tak Leung <htl10@users.sourceforge.net>,
Sergei Antonov <saproj@gmail.com>
Subject: [PATCH] hfsplus: emit symlinks from readdir properly
Date: Wed, 7 May 2014 14:08:14 +0200 [thread overview]
Message-ID: <1399464494-12540-1-git-send-email-saproj@gmail.com> (raw)
hfsplus_readdir() did not return DT_LNK record type for symbolic links. It
emitted them as regular files (DT_REG). Programs relying on information from
readdir did not work correctly with HFS+.
CC: Al Viro <viro@zeniv.linux.org.uk>
CC: Christoph Hellwig <hch@infradead.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Vyacheslav Dubeyko <slava@dubeyko.com>
CC: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Sergei Antonov <saproj@gmail.com>
---
fs/hfsplus/dir.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index bdec665..c5ccb11 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -212,13 +212,17 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx)
be32_to_cpu(entry.folder.id), DT_DIR))
break;
} else if (type == HFSPLUS_FILE) {
+ u16 mode;
+
if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
pr_err("small file entry\n");
err = -EIO;
goto out;
}
+ mode = be16_to_cpu(entry.file.permissions.mode);
if (!dir_emit(ctx, strbuf, len,
- be32_to_cpu(entry.file.id), DT_REG))
+ be32_to_cpu(entry.file.id),
+ S_ISLNK(mode) ? DT_LNK : DT_REG))
break;
} else {
pr_err("bad catalog entry type\n");
--
1.9.0
next reply other threads:[~2014-05-07 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 12:08 Sergei Antonov [this message]
2014-05-07 14:18 ` [PATCH] hfsplus: emit symlinks from readdir properly Vyacheslav Dubeyko
2014-05-07 14:51 ` Sergei Antonov
-- strict thread matches above, loose matches on Subject: below --
2014-05-07 12:20 Hin-Tak Leung
2014-05-07 12:27 ` Sergei Antonov
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=1399464494-12540-1-git-send-email-saproj@gmail.com \
--to=saproj@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=htl10@users.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=slava@dubeyko.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).