From a8567fdb9367a1d792fc2c0733790f5f763d00f1 Mon Sep 17 00:00:00 2001 From: Gabriel Krisman Bertazi Date: Sun, 28 Apr 2019 16:45:41 -0400 Subject: [PATCH] ext2fs: don't normalize names on -F directories As agreed on the new design, even if fname_encoding is enabled, directories entries who aren't owned by a +F directory will not be normalized. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Theodore Ts'o --- lib/ext2fs/dirhash.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/ext2fs/dirhash.c b/lib/ext2fs/dirhash.c index f1e7734..b9afb59 100644 --- a/lib/ext2fs/dirhash.c +++ b/lib/ext2fs/dirhash.c @@ -281,15 +281,11 @@ errcode_t ext2fs_dirhash2(int version, const char *name, int len, int dlen; unsigned char *buff; - if (len && charset) { + if (len && charset && (hash_flags & EXT4_CASEFOLD_FL)) { char buff[PATH_MAX]; - if (hash_flags & EXT4_CASEFOLD_FL) - dlen = charset->ops->casefold(charset, name, len, buff, + dlen = charset->ops->casefold(charset, name, len, buff, sizeof(buff)); - else - dlen = charset->ops->normalize(charset, name, len, buff, - sizeof(buff)); if (dlen < 0) { if (dlen == -EINVAL) goto opaque_seq; -- 1.8.3.1