fix volume label bug (rodries)

This commit is contained in:
tantricity 2010-09-18 17:56:47 +00:00
parent d5702c9f29
commit 571d57ee0a

View File

@ -439,24 +439,25 @@ bool _FAT_directory_getVolumeLabel (PARTITION* partition, char *label) {
end = false; end = false;
//this entry should be among the first 3 entries in the root directory table, if not, then system can have trouble displaying the right volume label //this entry should be among the first 3 entries in the root directory table, if not, then system can have trouble displaying the right volume label
while(!end) { while(!end) {
if (_FAT_directory_incrementDirEntryPosition (partition, &entryEnd, false) == false) {
end = true;
}
if(!_FAT_cache_readPartialSector (partition->cache, entryData, if(!_FAT_cache_readPartialSector (partition->cache, entryData,
_FAT_fat_clusterToSector(partition, entryEnd.cluster) + entryEnd.sector, _FAT_fat_clusterToSector(partition, entryEnd.cluster) + entryEnd.sector,
entryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE)) entryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE))
{ //error reading { //error reading
return false; return false;
} }
if (entryData[DIR_ENTRY_attributes] == ATTRIB_VOL && entryData[0] != DIR_ENTRY_FREE) { if (entryData[DIR_ENTRY_attributes] == ATTRIB_VOL && entryData[0] != DIR_ENTRY_FREE) {
for (i = 0; i < 11; i++) { for (i = 0; i < 11; i++) {
label[i] = entryData[DIR_ENTRY_name + i]; label[i] = entryData[DIR_ENTRY_name + i];
} }
return true; return true;
} else if (entryData[0] == DIR_ENTRY_LAST) { } else if (entryData[0] == DIR_ENTRY_LAST) {
end = true; end = true;
} }
if (_FAT_directory_incrementDirEntryPosition (partition, &entryEnd, false) == false) {
end = true;
}
} }
return false; return false;
} }