Skip to content

Commit 92aa382

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 a19250e commit 92aa382

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
@@ -1171,16 +1171,11 @@ impl FatVolume {
11711171
ctime: now,
11721172
attributes: att,
11731173
// point at our parent
1174-
cluster: match fat_type {
1175-
FatType::Fat16 => {
1176-
// On FAT16, indicate parent is root using Cluster(0)
1177-
if parent == ClusterId::ROOT_DIR {
1178-
ClusterId::EMPTY
1179-
} else {
1180-
parent
1181-
}
1182-
}
1183-
FatType::Fat32 => parent,
1174+
cluster: if parent == ClusterId::ROOT_DIR {
1175+
// indicate parent is root using Cluster(0)
1176+
ClusterId::EMPTY
1177+
} else {
1178+
parent
11841179
},
11851180
size: 0,
11861181
entry_block: new_dir_start_block,

0 commit comments

Comments
 (0)