aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fat/dir.c')
-rw-r--r--fs/fat/dir.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 054acd9fd033..16795955acad 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -367,7 +367,8 @@ static int fat_parse_short(struct super_block *sb,
dotoffset = 1;
}
- memcpy(work, de->name, sizeof(work));
+ memcpy(work, de->name, sizeof(de->name));
+
/* For an explanation of the special treatment of 0x05 in
* filenames, see msdos_format_name in namei_msdos.c
*/
@@ -499,6 +500,13 @@ parse_record:
goto end_of_dir;
}
+ /*
+ * The FAT_NO_83NAME flag is used to mark files
+ * created with no 8.3 short name
+ */
+ if (de->lcase & FAT_NO_83NAME)
+ goto compare_longname;
+
/* Never prepend '.' to hidden files here.
* That is done only for msdos mounts (and only when
* 'dotsOK=yes'); if we are executing here, it is in the
@@ -512,6 +520,7 @@ parse_record:
if (fat_name_match(sbi, name, name_len, bufname, len))
goto found;
+compare_longname:
if (nr_slots) {
void *longname = unicode + FAT_MAX_UNI_CHARS;
int size = PATH_MAX - FAT_MAX_UNI_SIZE;
@@ -603,6 +612,8 @@ parse_record:
if (de->attr != ATTR_EXT && IS_FREE(de->name))
goto record_end;
} else {
+ if (de->lcase & FAT_NO_83NAME)
+ goto record_end;
if ((de->attr & ATTR_VOLUME) || IS_FREE(de->name))
goto record_end;
}
@@ -961,6 +972,10 @@ int fat_scan(struct inode *dir, const unsigned char *name,
sinfo->bh = NULL;
while (fat_get_short_entry(dir, &sinfo->slot_off, &sinfo->bh,
&sinfo->de) >= 0) {
+ /* skip files marked as having no 8.3 short name */
+ if (sinfo->de->lcase & FAT_NO_83NAME)
+ continue;
+
if (!strncmp(sinfo->de->name, name, MSDOS_NAME)) {
sinfo->slot_off -= sizeof(*sinfo->de);
sinfo->nr_slots = 1;
@@ -1288,7 +1303,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
struct super_block *sb = dir->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(sb);
struct buffer_head *bh, *prev, *bhs[3]; /* 32*slots (672bytes) */
- struct msdos_dir_entry *uninitialized_var(de);
+ struct msdos_dir_entry *de;
int err, free_slots, i, nr_bhs;
loff_t pos, i_pos;