From: Tuupertunut tuupertunut@outlook.com
--- dlls/ntdll/unix/file.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index e09e8cafc82..eaca5297680 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -148,6 +148,18 @@ typedef struct /* Case-insensitivity attribute */ #define EXT4_CASEFOLD_FL 0x40000000
+#ifndef EXT4_SUPER_MAGIC +#define EXT4_SUPER_MAGIC 0xef53 +#endif + +#ifndef F2FS_SUPER_MAGIC +#define F2FS_SUPER_MAGIC 0xf2f52010 +#endif + +#ifndef FUSE_SUPER_MAGIC +#define FUSE_SUPER_MAGIC 0x65735546 +#endif + #ifndef O_DIRECTORY # define O_DIRECTORY 0200000 /* must be directory */ #endif @@ -1163,15 +1175,20 @@ static BOOLEAN get_dir_case_sensitivity_stat( const char *dir ) if ((fd = open( dir, O_RDONLY | O_NONBLOCK )) == -1) return TRUE;
- if (ioctl( fd, EXT2_IOC_GETFLAGS, &flags ) != -1 && (flags & EXT4_CASEFOLD_FL)) + if (fstatfs( fd, &stfs ) != -1) { - sens = FALSE; - } - else if (fstatfs( fd, &stfs ) == 0 && /* CIOPFS is case insensitive. Instead of */ - stfs.f_type == 0x65735546 /* FUSE_SUPER_MAGIC */ && /* parsing mtab to discover if the FUSE FS */ - fstatat( fd, ".ciopfs", &st, AT_NO_AUTOMOUNT ) == 0) /* is CIOPFS, look for .ciopfs in the dir. */ - { - sens = FALSE; + /* EXT4 and F2FS have a flag that makes a directory case insensitive. */ + if ((stfs.f_type == EXT4_SUPER_MAGIC || stfs.f_type == F2FS_SUPER_MAGIC) && + ioctl( fd, EXT2_IOC_GETFLAGS, &flags ) != -1 && (flags & EXT4_CASEFOLD_FL)) + { + sens = FALSE; + } + /* CIOPFS is case insensitive. Instead of parsing mtab to discover if the FUSE FS is CIOPFS, + * look for .ciopfs in the dir. */ + else if (stfs.f_type == FUSE_SUPER_MAGIC && fstatat( fd, ".ciopfs", &st, AT_NO_AUTOMOUNT ) == 0) + { + sens = FALSE; + } }
close( fd );