hal/hald/linux/volume_id volume_id.c,1.45.2.4,1.45.2.5
Kay Sievers
kay at freedesktop.org
Mon Jan 17 03:25:19 PST 2005
Update of /cvs/hal/hal/hald/linux/volume_id
In directory gabe:/tmp/cvs-serv9354/hald/linux/volume_id
Modified Files:
Tag: hal-0_4-stable-branch
volume_id.c
Log Message:
2005-01-17 Kay Sievers <kay.sievers at vrfy.org>
* hald/linux/volume_id/volume_id.c: (probe_vfat): Skip NTFS
signed volumes. Accept directory volume label entry only if the
entry has no cluster associated.
Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.45.2.4
retrieving revision 1.45.2.5
diff -u -d -r1.45.2.4 -r1.45.2.5
--- volume_id.c 12 Jan 2005 02:05:31 -0000 1.45.2.4
+++ volume_id.c 17 Jan 2005 11:25:17 -0000 1.45.2.5
@@ -859,6 +859,9 @@
/* believe only that's fat, don't trust the version
* the cluster_count will tell us
*/
+ if (strncmp(vs->sysid, "NTFS", 4) == 0)
+ return -1;
+
if (strncmp(vs->type.fat32.magic, "MSWIN", 5) == 0)
goto valid;
@@ -967,7 +970,8 @@
if (dir[i].name[0] == FAT_ENTRY_FREE)
continue;
- if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) {
+ if (((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) &&
+ dir[i].cluster_high == 0 && dir[i].cluster_low == 0) {
dbg("found ATTR_VOLUME_ID id in root dir");
label = dir[i].name;
break;
@@ -976,6 +980,10 @@
dbg("skip dir entry");
}
+ vs = (struct vfat_super_block *) get_buffer(id, off, 0x200);
+ if (vs == NULL)
+ return -1;
+
if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) {
set_label_raw(id, label, 11);
set_label_string(id, label, 11);
@@ -1026,7 +1034,8 @@
if (dir[i].name[0] == FAT_ENTRY_FREE)
continue;
- if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) {
+ if (((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) &&
+ dir[i].cluster_high == 0 && dir[i].cluster_low == 0) {
dbg("found ATTR_VOLUME_ID id in root dir");
label = dir[i].name;
goto fat32_label;
@@ -1050,6 +1059,10 @@
dbg("reached maximum follow count of root cluster chain, give up");
fat32_label:
+ vs = (struct vfat_super_block *) get_buffer(id, off, 0x200);
+ if (vs == NULL)
+ return -1;
+
if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) {
set_label_raw(id, label, 11);
set_label_string(id, label, 11);
More information about the hal-commit
mailing list