On Thu, Jun 13, 2019 at 06:53:59PM +0300, Gabriel Ivăncescu wrote:
+ if ((fd = open( dir, O_RDONLY | O_NONBLOCK | O_LARGEFILE )) == -1) return TRUE; - /* Normally, we'd have to parse the mtab to find out exactly what - * kind of FUSE FS this is. But, someone on wine-devel suggested - * a shortcut. We'll stat a special file in the directory. If it's - * there, we'll assume it's a CIOPFS, else not. - * This will break if somebody puts a file named ".ciopfs" in a non- - * CIOPFS directory. - */ - cifile = RtlAllocateHeap( GetProcessHeap(), 0, strlen( dir )+sizeof("/.ciopfs") ); - if (!cifile) return TRUE; - strcpy( cifile, dir ); - strcat( cifile, "/.ciopfs" ); - if (stat( cifile, &st ) == 0) + + if (ioctl( fd, EXT2_IOC_GETFLAGS, &flags ) != -1 && (flags & EXT4_CASEFOLD_FL)) { - RtlFreeHeap( GetProcessHeap(), 0, cifile ); - return FALSE; + sens = FALSE; } - RtlFreeHeap( GetProcessHeap(), 0, cifile ); - return TRUE; + else + { + /* Assume CIOPFS is case insensitive. Normally, we'd have to parse + * the mtab to find out exactly what kind of FUSE FS this is. But, + * someone on wine-devel suggested a shortcut. We'll stat a special + * file in the directory. If it's there, we'll assume it's a CIOPFS, + * else not. This will break if somebody puts a file named ".ciopfs" + * in a non-CIOPFS directory. + */ + if (fstatfs( fd, &stfs ) != -1 && stfs.f_type == 0x65735546 /* FUSE_SUPER_MAGIC */ && + fstatat( fd, ".ciopfs", &st, AT_NO_AUTOMOUNT ) == 0) + sens = FALSE; + } + close( fd ); + return sens; #else return TRUE; #endif
I've sent in a new version with a few changes. Most notably I've trimmed the CIOPFS comment right down. I've also inverted the return value check of fstatfs() to match that of fstatat(). Huw.