diff options
Diffstat (limited to 'firmware/common/file.c')
-rw-r--r-- | firmware/common/file.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 830a7eef8a..bc57d556b3 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -501,7 +501,7 @@ static int readwrite(int fd, void* buf, long count, bool write) | |||
501 | 501 | ||
502 | if (offs + headbytes == SECTOR_SIZE) { | 502 | if (offs + headbytes == SECTOR_SIZE) { |
503 | if (file->dirty) { | 503 | if (file->dirty) { |
504 | int rc = flush_cache(fd); | 504 | rc = flush_cache(fd); |
505 | if ( rc < 0 ) { | 505 | if ( rc < 0 ) { |
506 | errno = EIO; | 506 | errno = EIO; |
507 | return rc * 10 - 2; | 507 | return rc * 10 - 2; |
@@ -524,7 +524,7 @@ static int readwrite(int fd, void* buf, long count, bool write) | |||
524 | /* read/write whole sectors right into/from the supplied buffer */ | 524 | /* read/write whole sectors right into/from the supplied buffer */ |
525 | sectors = count / SECTOR_SIZE; | 525 | sectors = count / SECTOR_SIZE; |
526 | if ( sectors ) { | 526 | if ( sectors ) { |
527 | int rc = fat_readwrite(&(file->fatfile), sectors, | 527 | rc = fat_readwrite(&(file->fatfile), sectors, |
528 | (unsigned char*)buf+nread, write ); | 528 | (unsigned char*)buf+nread, write ); |
529 | if ( rc < 0 ) { | 529 | if ( rc < 0 ) { |
530 | DEBUGF("Failed read/writing %ld sectors\n",sectors); | 530 | DEBUGF("Failed read/writing %ld sectors\n",sectors); |
@@ -561,7 +561,6 @@ static int readwrite(int fd, void* buf, long count, bool write) | |||
561 | if (write) { | 561 | if (write) { |
562 | if ( file->fileoffset + nread < file->size ) { | 562 | if ( file->fileoffset + nread < file->size ) { |
563 | /* sector is only partially filled. copy-back from disk */ | 563 | /* sector is only partially filled. copy-back from disk */ |
564 | int rc; | ||
565 | LDEBUGF("Copy-back tail cache\n"); | 564 | LDEBUGF("Copy-back tail cache\n"); |
566 | rc = fat_readwrite(&(file->fatfile), 1, file->cache, false ); | 565 | rc = fat_readwrite(&(file->fatfile), 1, file->cache, false ); |
567 | if ( rc < 0 ) { | 566 | if ( rc < 0 ) { |