Show
Ignore:
Timestamp:
02/24/09 20:55:43 (3 years ago)
Author:
mwhitworth
Message:

Fix bug involving incorrect root directory pointer on FAT32 (i.e. parent pointer should be zero rather than the true root dir start).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/fs/fat/vnode.c

    r1909 r1911  
    215215                 
    216216        /* Is the root directory then */ 
    217         if (!startCluster || ( (info->fatType == 32) && (info->rootDirStart == startCluster) )) 
     217        if (!startCluster) 
    218218                return FAT_ROOT_ID; 
    219219 
     
    710710 
    711711        dirEntry=(struct FatDirEntry*)(buffer->data+FAT_DIR_POS(VNUM_TO_OFFSET(vNum))); 
    712         dirEntry->startClusterHigh=FatGetPriv(dir)->startCluster >> 16; 
    713         dirEntry->startClusterLow=FatGetPriv(dir)->startCluster & 0xFFFF; 
     712         
     713        if (dir->id != FAT_ROOT_ID) 
     714        { 
     715                dirEntry->startClusterHigh=FatGetPriv(dir)->startCluster >> 16; 
     716                dirEntry->startClusterLow=FatGetPriv(dir)->startCluster & 0xFFFF; 
     717        }else{ 
     718                /* If the parent is the root directory, the start cluster should 
     719                 * always point to 0, even on FAT32, where the root directory has its 
     720                 * own start cluster. 
     721                 */ 
     722                dirEntry->startClusterHigh = 0; 
     723                dirEntry->startClusterLow = 0; 
     724        } 
     725         
    714726        dirEntry->fileSize=0; 
    715727