From 46ddacf533b2b154373f0ac98c85b4ac172ccfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Tue, 22 Oct 2002 15:06:08 +0000 Subject: Fat32 write updates: Nixed some bugs. Basic file creation now works. Todo: Long filenames and extensive test cases. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2742 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/file.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'firmware/common') diff --git a/firmware/common/file.c b/firmware/common/file.c index 3e402bd..0cde938 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -178,7 +178,7 @@ int close(int fd) } /* tie up all loose ends */ - fat_closewrite(&(openfiles[fd].fatfile), openfiles[fd].size); + fat_closewrite(&(openfiles[fd].fatfile), openfiles[fd].fileoffset); } openfiles[fd].busy = false; return rc; @@ -239,8 +239,6 @@ static int readwrite(int fd, void* buf, int count, bool write) nread = headbytes; count -= headbytes; - - LDEBUGF("readwrite incache: offs=%d\n",openfiles[fd].cacheoffset); } /* read whole sectors right into the supplied buffer */ @@ -316,6 +314,13 @@ int lseek(int fd, int offset, int whence) return -1; } + if ( openfiles[fd].write ) { + DEBUGF("lseek() is not supported when writing\n"); + errno = EROFS; + return -2; + } + + switch ( whence ) { case SEEK_SET: pos = offset; -- cgit v1.1