diff options
author | Gabriel Marcano <gabemarcano@yahoo.com> | 2023-09-13 07:50:32 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2023-09-28 15:04:06 +0300 |
commit | 85a4780dc96ed9dd643bbadf236552b3320fae26 (patch) | |
tree | 2d2d21d82fd6dc606f2db7a776aeb397b92613de /fs/ntfs3/dir.c | |
parent | 1f9b94af923c88539426ed811ae7e9543834a5c5 (diff) | |
download | linux-85a4780dc96ed9dd643bbadf236552b3320fae26.tar.xz |
fs/ntfs3: Fix directory element type detection
Calling stat() from userspace correctly identified junctions in an NTFS
partition as symlinks, but using readdir() and iterating through the
directory containing the same junction did not identify the junction
as a symlink.
When emitting directory contents, check FILE_ATTRIBUTE_REPARSE_POINT
attribute to detect junctions and report them as links.
Signed-off-by: Gabriel Marcano <gabemarcano@yahoo.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/dir.c')
-rw-r--r-- | fs/ntfs3/dir.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c index 063a6654199b..ec0566b322d5 100644 --- a/fs/ntfs3/dir.c +++ b/fs/ntfs3/dir.c @@ -309,7 +309,11 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni, return 0; } - dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG; + /* NTFS: symlinks are "dir + reparse" or "file + reparse" */ + if (fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT) + dt_type = DT_LNK; + else + dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG; return !dir_emit(ctx, (s8 *)name, name_len, ino, dt_type); } |