Skip to content

Commit 567aa09

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 a6cc6cd commit 567aa09

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
@@ -1297,16 +1297,11 @@ impl FatVolume {
12971297
ctime: now,
12981298
attributes: att,
12991299
// point at our parent
1300-
cluster: match fat_type {
1301-
FatType::Fat16 => {
1302-
// On FAT16, indicate parent is root using Cluster(0)
1303-
if parent == ClusterId::ROOT_DIR {
1304-
ClusterId::EMPTY
1305-
} else {
1306-
parent
1307-
}
1308-
}
1309-
FatType::Fat32 => parent,
1300+
cluster: if parent == ClusterId::ROOT_DIR {
1301+
// indicate parent is root using Cluster(0)
1302+
ClusterId::EMPTY
1303+
} else {
1304+
parent
13101305
},
13111306
size: 0,
13121307
entry_block: new_dir_start_block,

0 commit comments

Comments
 (0)