From f95ce0fff0775c04954ae2e4542308baaa434ac8 Mon Sep 17 00:00:00 2001 From: Zahari Doychev Date: Tue, 4 Nov 2014 08:54:01 +0100 Subject: common: fix mbr filetype detection Sometimes mbr is erroneously recocognised as FAT partion. Due to this the mbr partition parser is not being called and the partitions on the media are not detected. This patch should fix the problem. The checking is done as in the linux kernel. I have seen the problem using usb sticks. Although partitioning and formatting them under linux. The file system type field in the mbr remains there which causes the wrong detections as FAT32 type and not as mbr. Signed-off-by: Zahari Doychev Signed-off-by: Sascha Hauer --- common/partitions.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/partitions.c') diff --git a/common/partitions.c b/common/partitions.c index 694c6f6dd5..37d9cb7edc 100644 --- a/common/partitions.c +++ b/common/partitions.c @@ -107,6 +107,8 @@ static struct partition_parser *partition_parser_get_by_filetype(uint8_t *buf) * useful for compatibility */ type = file_detect_partition_table(buf, SECTOR_SIZE); + if (type == filetype_fat && !is_fat_boot_sector(buf)) + type = filetype_mbr; list_for_each_entry(parser, &partition_parser_list, list) { if (parser->type == type) -- cgit v1.2.3