From 533d8192e9cf462be397fcbfef0656d927d6e088 Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Tue, 1 Jun 2021 14:57:43 +0900 Subject: [PATCH] exfat: strip trailing spaces from filename exfat follow file naming conventions to avoid compatibility issue with Windows. So It strip trailing spaces as well as periods from filename. Reviewed-by: Sungjong Seo Signed-off-by: Namjae Jeon --- namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/namei.c b/namei.c index f7182d3..735a540 100644 --- a/namei.c +++ b/namei.c @@ -73,10 +73,10 @@ static int exfat_d_revalidate(struct dentry *dentry, unsigned int flags) return ret; } -/* returns the length of a struct qstr, ignoring trailing dots */ +/* returns the length of a struct qstr, ignoring trailing dots and spaces */ static unsigned int exfat_striptail_len(unsigned int len, const char *name) { - while (len && name[len - 1] == '.') + while (len && (name[len - 1] == '.' || name[len - 1] == ' ')) len--; return len; } @@ -445,7 +445,7 @@ static int __exfat_resolve_path(struct inode *inode, const unsigned char *path, struct exfat_sb_info *sbi = EXFAT_SB(sb); struct exfat_inode_info *ei = EXFAT_I(inode); - /* strip all trailing periods */ + /* strip all trailing periods and spaces */ namelen = exfat_striptail_len(strlen(path), path); if (!namelen) return -ENOENT;