Skip to content

Commit 533d819

Browse files
committed
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 <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent a52427b commit 533d819

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

namei.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ static int exfat_d_revalidate(struct dentry *dentry, unsigned int flags)
7373
return ret;
7474
}
7575

76-
/* returns the length of a struct qstr, ignoring trailing dots */
76+
/* returns the length of a struct qstr, ignoring trailing dots and spaces */
7777
static unsigned int exfat_striptail_len(unsigned int len, const char *name)
7878
{
79-
while (len && name[len - 1] == '.')
79+
while (len && (name[len - 1] == '.' || name[len - 1] == ' '))
8080
len--;
8181
return len;
8282
}
@@ -445,7 +445,7 @@ static int __exfat_resolve_path(struct inode *inode, const unsigned char *path,
445445
struct exfat_sb_info *sbi = EXFAT_SB(sb);
446446
struct exfat_inode_info *ei = EXFAT_I(inode);
447447

448-
/* strip all trailing periods */
448+
/* strip all trailing periods and spaces */
449449
namelen = exfat_striptail_len(strlen(path), path);
450450
if (!namelen)
451451
return -ENOENT;

0 commit comments

Comments
 (0)