freemyipod r862 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r861‎ | r862 | r863 >
Date:21:16, 22 February 2012
Author:theseven
Status:new
Tags:
Comment:
emCORE: Fix a rather obvious FAT directory creation bug
Modified paths:
  • /emcore/trunk/fat.c (modified) (history)

Diff [purge]

Index: emcore/trunk/fat.c
@@ -1762,10 +1762,10 @@
17631763 memcpy(&buf[0x20], ".. \x10", 12);
17641764 ((uint16_t*)buf)[0xd] = newdir.firstcluster;
17651765 ((uint16_t*)buf)[0xa] = newdir.firstcluster >> 16;
1766 - if(dir->file.firstcluster == fat_bpb->bpb_rootclus)
 1766+ if(dir->file.firstcluster != fat_bpb->bpb_rootclus)
17671767 {
1768 - ((uint16_t*)buf)[0x1d] = fat_bpb->bpb_rootclus;
1769 - ((uint16_t*)buf)[0x1a] = fat_bpb->bpb_rootclus >> 16;
 1768+ ((uint16_t*)buf)[0x1d] = dir->file.firstcluster;
 1769+ ((uint16_t*)buf)[0x1a] = dir->file.firstcluster >> 16;
17701770 }
17711771 }
17721772 rc = transfer(IF_MV2(fat_bpb,) sector + i, 1, buf, true );