Skip to content

Commit d904261

Browse files
committed
Use cluster 0 when the parent dir is the root, for both FAT16 and FAT32.
fsck was getting annoyed at this.
1 parent 6eb665b commit d904261

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/fat/volume.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,16 +1186,11 @@ impl FatVolume {
11861186
ctime: now,
11871187
attributes: att,
11881188
// point at our parent
1189-
cluster: match fat_type {
1190-
FatType::Fat16 => {
1191-
// On FAT16, indicate parent is root using Cluster(0)
1192-
if parent == ClusterId::ROOT_DIR {
1193-
ClusterId::EMPTY
1194-
} else {
1195-
parent
1196-
}
1197-
}
1198-
FatType::Fat32 => parent,
1189+
cluster: if parent == ClusterId::ROOT_DIR {
1190+
// indicate parent is root using Cluster(0)
1191+
ClusterId::EMPTY
1192+
} else {
1193+
parent
11991194
},
12001195
size: 0,
12011196
entry_block: new_dir_start_block,

0 commit comments

Comments
 (0)