From 5b743baab133d16908f3a3251f8a53f20106e3fc Mon Sep 17 00:00:00 2001 From: qiuyiuestc Date: Wed, 10 Feb 2010 13:53:24 +0000 Subject: [PATCH] fix efs write problem git-svn-id: https://rt-thread.googlecode.com/svn/trunk@401 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- filesystem/dfs/filesystems/efsl/src/fs/vfat/file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/filesystem/dfs/filesystems/efsl/src/fs/vfat/file.c b/filesystem/dfs/filesystems/efsl/src/fs/vfat/file.c index 4bd0593f53..c3c8db5261 100644 --- a/filesystem/dfs/filesystems/efsl/src/fs/vfat/file.c +++ b/filesystem/dfs/filesystems/efsl/src/fs/vfat/file.c @@ -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 {