diff options
author | marcus <marcus@FreeBSD.org> | 2007-05-31 04:20:09 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2007-05-31 04:20:09 +0800 |
commit | 11680f96b216e47a5f490b4d8de51c5b045bff98 (patch) | |
tree | d5c37c1784db25a88622735044121009b6358f47 | |
parent | 6bad5b677f34d24a61e93f826a925f442543aa47 (diff) | |
download | freebsd-ports-gnome-11680f96b216e47a5f490b4d8de51c5b045bff98.tar.gz freebsd-ports-gnome-11680f96b216e47a5f490b4d8de51c5b045bff98.tar.zst freebsd-ports-gnome-11680f96b216e47a5f490b4d8de51c5b045bff98.zip |
Make sure we only read in sector-sized chunks from the disk to avoid EINVAL
errors. This will fix problems detecting FAT file systems on certain media
that does not use a 512-byte sector size.
Reported by: James Snyder <jbsnyder@gmail.com>
Tested by: James Snyder <jbsnyder@gmail.com>
-rw-r--r-- | devel/libvolume_id/Makefile | 1 | ||||
-rw-r--r-- | devel/libvolume_id/files/patch-fat.c | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/devel/libvolume_id/Makefile b/devel/libvolume_id/Makefile index 1d041338f293..0658217f5806 100644 --- a/devel/libvolume_id/Makefile +++ b/devel/libvolume_id/Makefile @@ -6,6 +6,7 @@ PORTNAME= libvolume_id PORTVERSION= 0.75.0 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= http://www.marcuscom.com/downloads/ diff --git a/devel/libvolume_id/files/patch-fat.c b/devel/libvolume_id/files/patch-fat.c new file mode 100644 index 000000000000..2780d613c9de --- /dev/null +++ b/devel/libvolume_id/files/patch-fat.c @@ -0,0 +1,38 @@ +--- fat.c.orig Wed May 30 16:16:49 2007 ++++ fat.c Wed May 30 16:17:12 2007 +@@ -277,7 +277,7 @@ magic: + + label = get_attr_volume_id(dir, root_dir_entries); + +- vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); ++ vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, sector_size); + if (vs == NULL) + return -1; + +@@ -294,7 +294,7 @@ magic: + fat32: + /* FAT32 should have a valid signature in the fsinfo block */ + 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), sector_size); + if (buf == NULL) + return -1; + fsinfo = (struct fat32_fsinfo *) buf; +@@ -303,7 +303,7 @@ fat32: + if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0) + err("Found invalid signature2: 0x%08x", fsinfo->signature2); + +- vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); ++ vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, sector_size); + if (vs == NULL) + return -1; + +@@ -355,7 +355,7 @@ fat32: + if (maxloop == 0) + dbg("reached maximum follow count of root cluster chain, give up"); + +- vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); ++ vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, sector_size); + if (vs == NULL) + return -1; + |