fix FAT_setAttr

This commit is contained in:
Dave Murphy 2014-12-15 02:21:51 +00:00
parent d468306a18
commit b42fdc447c

View File

@ -48,6 +48,10 @@
bool _FAT_findEntry(const char *path, DIR_ENTRY *dirEntry) { bool _FAT_findEntry(const char *path, DIR_ENTRY *dirEntry) {
PARTITION *partition = _FAT_partition_getPartitionFromPath(path); PARTITION *partition = _FAT_partition_getPartitionFromPath(path);
// Check Partition
if( !partition )
return false;
// Move the path pointer to the start of the actual path // Move the path pointer to the start of the actual path
if (strchr (path, ':') != NULL) { if (strchr (path, ':') != NULL) {
path = strchr (path, ':') + 1; path = strchr (path, ':') + 1;
@ -73,7 +77,7 @@ int FAT_setAttr(const char *file, int attr) {
// Defines... // Defines...
DIR_ENTRY_POSITION entryEnd; DIR_ENTRY_POSITION entryEnd;
PARTITION *partition = NULL; PARTITION *partition = NULL;
DIR_ENTRY* dirEntry = NULL; DIR_ENTRY dirEntry;
// Get Partition // Get Partition
partition = _FAT_partition_getPartitionFromPath( file ); partition = _FAT_partition_getPartitionFromPath( file );
@ -89,11 +93,11 @@ int FAT_setAttr(const char *file, int attr) {
return -1; return -1;
// Get DIR_ENTRY // Get DIR_ENTRY
if( !_FAT_directory_entryFromPath (partition, dirEntry, file, NULL) ) if( !_FAT_directory_entryFromPath (partition, &dirEntry, file, NULL) )
return -1; return -1;
// Get Entry-End // Get Entry-End
entryEnd = dirEntry->dataEnd; entryEnd = dirEntry.dataEnd;
// Lock Partition // Lock Partition
_FAT_lock(&partition->lock); _FAT_lock(&partition->lock);