seems a negative value has to be returned when not valid

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18744 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-09-05 08:27:39 +00:00
parent 482096e504
commit 6738c5a127
+8 -8
View File
@@ -572,39 +572,39 @@ dosfs_identify_partition(int fd, partition_data *partition, void **_cookie)
// read in the boot sector
if (read_pos(fd, 0, (void*)buf, 512) != 512) {
return 0.0f;
return -1;
}
// only check boot signature on hard disks to account for broken mtools
// behavior
if (((buf[0x1fe] != 0x55) || (buf[0x1ff] != 0xaa)) && (buf[0x15] == 0xf8))
return 0.0f;
return -1;
if (!memcmp(buf+3, "NTFS ", 8) || !memcmp(buf+3, "HPFS ", 8)) {
return 0.0f;
return -1;
}
// first fill in the universal fields from the bpb
bytes_per_sector = read16(buf,0xb);
if ((bytes_per_sector != 0x200) && (bytes_per_sector != 0x400) && (bytes_per_sector != 0x800)) {
return 0.0f;
return -1;
}
sectors_per_cluster = i = buf[0xd];
if ((i != 1) && (i != 2) && (i != 4) && (i != 8) &&
(i != 0x10) && (i != 0x20) && (i != 0x40) && (i != 0x80)) {
return 0.0f;
return -1;
}
reserved_sectors = read16(buf,0xe);
fat_count = buf[0x10];
if ((fat_count == 0) || (fat_count > 8)) {
return 0.0f;
return -1;
}
// check media descriptor versus known types
if ((buf[0x15] != 0xF0) && (buf[0x15] < 0xf8)) {
return 0.0f;
return -1;
}
strcpy(name, "no name ");
@@ -626,7 +626,7 @@ dosfs_identify_partition(int fd, partition_data *partition, void **_cookie)
cookie = (identify_cookie *)malloc(sizeof(identify_cookie));
if (!cookie)
return 0.0f;
return -1;
cookie->bytes_per_sector = bytes_per_sector;
cookie->total_sectors = total_sectors;