fix efs write problem

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@401 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2010-02-10 13:53:24 +00:00
parent 43907c8b79
commit 5b743baab1
1 changed files with 5 additions and 3 deletions

View File

@ -174,12 +174,14 @@ euint32 file_fwrite(File* file,euint32 offset,euint32 size,euint8* buf)
euint16 btr;
euint8 *tbuf;
if(!file_getAttr(file,FILE_STATUS_OPEN) || !file_getAttr(file,FILE_STATUS_WRITE))return(0);
if((!file_getAttr(file,FILE_STATUS_OPEN)) || (!file_getAttr(file,FILE_STATUS_WRITE)))return(0);
if(offset>file->FileSize){
offset=file->FileSize;
}
dfs_log(DFS_DEBUG_INFO, ("offset:%d", offset));
need_cluster = file_requiredCluster(file,offset,size);
if(need_cluster){
@ -513,8 +515,8 @@ esint8 file_fopen(File* file,FileSystem *fs,eint8* filename,eint32 mode)
fs_setFirstClusterInDirEntry(&(file->DirEntry),sec);
fat_setNextClusterAddress(fs,sec,fat_giveEocMarker(fs));
file_initFile(file,fs,&loc);
file_setpos(file,file->FileSize);
}
file_setpos(file,file->FileSize);
}
else
{