summaryrefslogtreecommitdiff
path: root/firmware/common/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common/file.c')
-rw-r--r--firmware/common/file.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 3e402bde2b..0cde938a70 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -178,7 +178,7 @@ int close(int fd)
178 } 178 }
179 179
180 /* tie up all loose ends */ 180 /* tie up all loose ends */
181 fat_closewrite(&(openfiles[fd].fatfile), openfiles[fd].size); 181 fat_closewrite(&(openfiles[fd].fatfile), openfiles[fd].fileoffset);
182 } 182 }
183 openfiles[fd].busy = false; 183 openfiles[fd].busy = false;
184 return rc; 184 return rc;
@@ -239,8 +239,6 @@ static int readwrite(int fd, void* buf, int count, bool write)
239 239
240 nread = headbytes; 240 nread = headbytes;
241 count -= headbytes; 241 count -= headbytes;
242
243 LDEBUGF("readwrite incache: offs=%d\n",openfiles[fd].cacheoffset);
244 } 242 }
245 243
246 /* read whole sectors right into the supplied buffer */ 244 /* read whole sectors right into the supplied buffer */
@@ -316,6 +314,13 @@ int lseek(int fd, int offset, int whence)
316 return -1; 314 return -1;
317 } 315 }
318 316
317 if ( openfiles[fd].write ) {
318 DEBUGF("lseek() is not supported when writing\n");
319 errno = EROFS;
320 return -2;
321 }
322
323
319 switch ( whence ) { 324 switch ( whence ) {
320 case SEEK_SET: 325 case SEEK_SET:
321 pos = offset; 326 pos = offset;