Skip to content

Commit

Permalink
exfat: strip trailing spaces from filename
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
namjaejeon committed Jun 1, 2021
1 parent a52427b commit 533d819
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 533d819

Please sign in to comment.