Skip to content

Commit 85a4780

Browse files
gemarcanoaalexandrovich
authored andcommitted
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>
1 parent 1f9b94a commit 85a4780

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/ntfs3/dir.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni,
309309
return 0;
310310
}
311311

312-
dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG;
312+
/* NTFS: symlinks are "dir + reparse" or "file + reparse" */
313+
if (fname->dup.fa & FILE_ATTRIBUTE_REPARSE_POINT)
314+
dt_type = DT_LNK;
315+
else
316+
dt_type = (fname->dup.fa & FILE_ATTRIBUTE_DIRECTORY) ? DT_DIR : DT_REG;
313317

314318
return !dir_emit(ctx, (s8 *)name, name_len, ino, dt_type);
315319
}

0 commit comments

Comments
 (0)