mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 20:25:38 +03:00
volume_id: fat - accept empty FAT32 fsinfo signature
This commit is contained in:
parent
779d2d851e
commit
387a827120
@ -411,7 +411,11 @@ magic:
|
|||||||
|
|
||||||
fat32:
|
fat32:
|
||||||
info("looking for FAT32\n");
|
info("looking for FAT32\n");
|
||||||
/* FAT32 should have a valid signature in the fsinfo block */
|
/*
|
||||||
|
* FAT32 should have a valid signature in the fsinfo block,
|
||||||
|
* but also allow all bytes set to '\0', because some volumes
|
||||||
|
* do not set the signature at all.
|
||||||
|
*/
|
||||||
fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector);
|
fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector);
|
||||||
buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200);
|
buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
@ -423,11 +427,13 @@ fat32:
|
|||||||
info("signature2: 0x%02x%02x%02x%02x\n",
|
info("signature2: 0x%02x%02x%02x%02x\n",
|
||||||
fsinfo->signature2[0], fsinfo->signature2[1],
|
fsinfo->signature2[0], fsinfo->signature2[1],
|
||||||
fsinfo->signature2[2], fsinfo->signature2[3]);
|
fsinfo->signature2[2], fsinfo->signature2[3]);
|
||||||
if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0)
|
if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0 &&
|
||||||
|
memcmp(fsinfo->signature1, "\x00\x00\x00\x00", 4) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0)
|
if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0 &&
|
||||||
|
memcmp(fsinfo->signature2, "\x00\x00\x00\x00", 4) != 0)
|
||||||
return -1 ;
|
return -1 ;
|
||||||
info("FAT32 signatures match\n");
|
info("FAT32 signatures ok\n");
|
||||||
|
|
||||||
vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
|
vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
|
||||||
if (vs == NULL)
|
if (vs == NULL)
|
||||||
|
@ -418,7 +418,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size
|
|||||||
* to make the filesystem detection successful.
|
* to make the filesystem detection successful.
|
||||||
*
|
*
|
||||||
* We do not want to read that many bytes from probed floppies, skip volumes
|
* We do not want to read that many bytes from probed floppies, skip volumes
|
||||||
* smaller than a usual floppy disk
|
* smaller than a usual floppy disk.
|
||||||
*/
|
*/
|
||||||
if (size > 1440 * 1024) {
|
if (size > 1440 * 1024) {
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user