fat: Loosen up check more and lower its priority in file.s2.c
diff --git a/common/fs/fat32.s2.c b/common/fs/fat32.s2.c
index 0eac8296..004e1de3 100644
--- a/common/fs/fat32.s2.c
+++ b/common/fs/fat32.s2.c
@@ -111,22 +111,20 @@ static int fat32_init_context(struct fat32_context* context, struct volume *part
// Checks for FAT12/16
if (strncmp((((void *)&bpb) + 0x36), "FAT", 3) == 0) {
- if (*(((uint8_t *)&bpb) + 0x26) != 0x29) {
- return 1;
- }
+ uint8_t sig = *(((uint8_t *)&bpb) + 0x26);
- goto valid;
+ if (sig == 0x29 || sig == 0xd0) {
+ goto valid;
+ }
}
// Checks for FAT32
if (strncmp((((void *)&bpb) + 0x52), "FAT", 3) == 0) {
uint8_t sig = *(((uint8_t *)&bpb) + 0x42);
- if (sig != 0x29 && sig != 0x28 && sig != 0xd0) {
- return 1;
+ if (sig == 0x29 || sig == 0x28 || sig == 0xd0) {
+ goto valid;
}
-
- goto valid;
}
return 1;
diff --git a/common/fs/file.s2.c b/common/fs/file.s2.c
index 9e5287bf..8ca41bfc 100644
--- a/common/fs/file.s2.c
+++ b/common/fs/file.s2.c
@@ -67,15 +67,15 @@ struct file_handle *fopen(struct volume *part, const char *filename) {
if ((ret = ext2_open(part, filename)) != NULL) {
goto success;
}
- if ((ret = fat32_open(part, filename)) != NULL) {
- goto success;
- }
if ((ret = iso9660_open(part, filename)) != NULL) {
goto success;
}
if ((ret = ntfs_open(part, filename)) != NULL) {
goto success;
}
+ if ((ret = fat32_open(part, filename)) != NULL) {
+ goto success;
+ }
return NULL;
